From 7c3bfa94f39a591f2f2d8b66ee831a58a56d4bb5 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 12 Aug 2022 12:58:39 +0700 Subject: [PATCH] handle thumbnail download base exception, #281 --- tubearchivist/home/src/download/thumbnails.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tubearchivist/home/src/download/thumbnails.py b/tubearchivist/home/src/download/thumbnails.py index 43cd981e..4e77453f 100644 --- a/tubearchivist/home/src/download/thumbnails.py +++ b/tubearchivist/home/src/download/thumbnails.py @@ -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)