commit: 7f3e07d1662f813f39195523a0f1f934123c927d
parent 0fde8febf96650b9e91d589277e0f4c4b79954a3
Author: Andrius Štikonas <andrius@stikonas.eu>
Date: Wed, 7 Sep 2022 20:45:46 +0100
Merge pull request #192 from doraskayo/requests-timeout
Add a timeout in requests.get()
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/sysgeneral.py b/lib/sysgeneral.py
@@ -101,7 +101,7 @@ this script the next time")
if not os.path.isfile(abs_file_name):
print(f"Downloading: {file_name}")
response = requests.get(url, allow_redirects=True, stream=True,
- headers=headers)
+ headers=headers, timeout=20)
if response.status_code == 200:
with open(abs_file_name, 'wb') as target_file:
target_file.write(response.raw.read())