handle thumbnail download base exception, #281

This commit is contained in:
simon 2022-08-12 12:58:39 +07:00
parent 25f1539816
commit 7c3bfa94f3
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 2 additions and 2 deletions

View File

@ -40,13 +40,13 @@ class ThumbManagerBase:
for i in range(3):
try:
response = requests.get(url, stream=True)
response = requests.get(url, stream=True, timeout=5)
if response.ok:
return Image.open(response.raw)
if response.status_code == 404:
return self.get_fallback()
except ConnectionError:
except requests.exceptions.RequestException:
print(f"{self.item_id}: retry thumbnail download {url}")
sleep((i + 1) ** i)