commit: 43a8cc6b50d32ac577b5e9f1cf74159607186867
parent 0fde8febf96650b9e91d589277e0f4c4b79954a3
Author: Dor Askayo <dor.askayo@gmail.com>
Date: Wed, 7 Sep 2022 22:35:09 +0300
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())