mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-08 20:29:27 +00:00
handle thumbnail download base exception, #281
This commit is contained in:
@@ -40,13 +40,13 @@ class ThumbManagerBase:
|
|||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, stream=True)
|
response = requests.get(url, stream=True, timeout=5)
|
||||||
if response.ok:
|
if response.ok:
|
||||||
return Image.open(response.raw)
|
return Image.open(response.raw)
|
||||||
if response.status_code == 404:
|
if response.status_code == 404:
|
||||||
return self.get_fallback()
|
return self.get_fallback()
|
||||||
|
|
||||||
except ConnectionError:
|
except requests.exceptions.RequestException:
|
||||||
print(f"{self.item_id}: retry thumbnail download {url}")
|
print(f"{self.item_id}: retry thumbnail download {url}")
|
||||||
sleep((i + 1) ** i)
|
sleep((i + 1) ** i)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user