1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 11:12:40 +01:00

add 'response' objects to 'HttpError's

This commit is contained in:
Mike Fährmann 2020-07-30 18:23:26 +02:00
parent 72c5578a27
commit d6a271d2c7
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 6 additions and 1 deletions

View File

@ -51,6 +51,11 @@ class HttpError(ExtractionError):
default = "HTTP request failed"
code = 4
def __init__(self, message, response=None):
ExtractionError.__init__(self, message)
self.response = response
self.status = response.status_code if response else 0
class NotFoundError(ExtractionError):
"""Requested resource (gallery/image) could not be found"""

View File

@ -125,7 +125,7 @@ class Extractor():
time.sleep(min(2 ** (tries-1), 1800))
tries += 1
raise exception.HttpError(msg)
raise exception.HttpError(msg, response)
def wait(self, *, seconds=None, until=None, adjust=1.0,
reason="rate limit reset"):