From 0844f7b91a3c82c9fa07c79c1f74bb43be1084e7 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 14 Oct 2021 14:44:50 +0700 Subject: [PATCH] add delayed retry for non 404 thumb download error --- tubearchivist/home/src/thumbnails.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tubearchivist/home/src/thumbnails.py b/tubearchivist/home/src/thumbnails.py index df72e926..6feccea4 100644 --- a/tubearchivist/home/src/thumbnails.py +++ b/tubearchivist/home/src/thumbnails.py @@ -4,6 +4,7 @@ functionality: """ import os +from time import sleep import home.src.download as download import requests @@ -110,6 +111,10 @@ class ThumbManager: } if img_url: response = requests.get(img_url, stream=True) + if not response.ok and not response.status_code == 404: + print("retry thumbnail download for " + img_url) + sleep(5) + response = requests.get(img_url, stream=True) else: response = False if not response or response.status_code == 404: