Skip to content

Commit

Permalink
Retry get request on failure
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Oct 30, 2023
1 parent 7db537a commit ef179b1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packagedb/management/commands/update_maven_download_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,15 @@ def next(self):


def check_download_url(download_url):
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
response = requests.get(download_url, headers=headers, timeout=TIMEOUT)
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
}
response = requests.get(
download_url,
headers=headers,
timeout=TIMEOUT,
retries=requests.adapters.Retry(10)
)
return response.ok


Expand Down

0 comments on commit ef179b1

Please sign in to comment.