don't raise an exception if a download fails (#5)

This commit is contained in:
Mike Fährmann 2016-11-23 13:07:44 +01:00
parent 2449825d53
commit 2b2bdce366
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -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