From 2b2bdce3666319e679d4198706df988ac6f3e110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 23 Nov 2016 13:07:44 +0100 Subject: [PATCH] don't raise an exception if a download fails (#5) --- gallery_dl/downloader/http.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 9367521f..488d186f 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -31,7 +31,7 @@ class Downloader(BasicDownloader): self.out.error(pathfmt.path, exptn, tries, self.max_tries) time.sleep(1) if tries == self.max_tries: - raise + return tries continue # reject error-status-codes @@ -39,9 +39,11 @@ class Downloader(BasicDownloader): tries += 1 self.out.error(pathfmt.path, 'HTTP status "{} {}"'.format( response.status_code, response.reason), tries, self.max_tries) + if response.status_code == 404: + return self.max_tries time.sleep(1) if tries == self.max_tries: - response.raise_for_status() + return tries continue # everything ok -- proceed to download