Missing one .get() not inside catch

This commit is contained in:
limkokhole
2021-04-08 21:17:00 +08:00
parent 2a19a3677c
commit 4917eab2fc

View File

@@ -626,8 +626,8 @@ def download_img(image, save_dir, arg_force_update, IMG_SESSION, V_SESSION, arg_
f.write(chunk) f.write(chunk)
#raise(requests.exceptions.ConnectionError) #raise(requests.exceptions.ConnectionError)
except (requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError, requests.exceptions.ChunkedEncodingError) as e: except (requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError, requests.exceptions.ChunkedEncodingError) as e:
r = IMG_SESSION.get(url, stream=True, timeout=(30, None))
try: try:
r = IMG_SESSION.get(url, stream=True, timeout=(30, None))
with open(file_path, 'wb') as f: with open(file_path, 'wb') as f:
for chunk in r: for chunk in r:
f.write(chunk) f.write(chunk)