mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-04 02:04:18 -07:00
Improve download retry logic
This commit is contained in:
parent
9e33932600
commit
d4898b8f55
4 changed files with 30 additions and 7 deletions
|
@ -147,9 +147,12 @@ def download_file_from_url(
|
|||
if not os.path.isdir(download_file_name.parent):
|
||||
os.mkdir(download_file_name.parent)
|
||||
|
||||
response = requests.get(
|
||||
file_url, verify=verify, timeout=settings.REQUESTS_DEFAULT_TIMOUT
|
||||
timeout = (
|
||||
settings.REQUEST_TIMEOUT
|
||||
if "REQUEST_TIMEOUT" in settings
|
||||
else settings.REQUESTS_DEFAULT_TIMOUT
|
||||
)
|
||||
response = requests.get(file_url, verify=verify, timeout=timeout)
|
||||
if response.status_code == 200:
|
||||
file_contents = response.content
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue