mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
Add timeout argument to requests.(get,post)
This commit is contained in:
parent
cf0100cf11
commit
c89a9f0e8b
11 changed files with 23 additions and 15 deletions
|
|
@ -28,7 +28,9 @@ def download_file(url, local_filename=None, dldir='tmp'):
|
|||
if local_filename is None:
|
||||
local_filename = os.path.join(dldir, filename)
|
||||
# the stream=True parameter keeps memory usage low
|
||||
r = requests.get(url, stream=True, allow_redirects=True, headers=HEADERS)
|
||||
r = requests.get(
|
||||
url, stream=True, allow_redirects=True, headers=HEADERS, timeout=300
|
||||
)
|
||||
r.raise_for_status()
|
||||
with open(local_filename, 'wb') as f:
|
||||
for chunk in r.iter_content(chunk_size=1024):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue