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:
parent
72c5578a27
commit
d6a271d2c7
@ -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"""
|
||||
|
@ -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"):
|
||||
|
Loading…
Reference in New Issue
Block a user