aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/imgur.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2020-08-15 17:48:11 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2020-08-15 17:48:11 -0400
commit7cf59dc17c3607e096292462ed15d391be4e3dfd (patch)
tree50d2750e958f43271dc6cc5310211cf8f8bbd9d0 /gallery_dl/extractor/imgur.py
parentba039cfb2e1ba2522ee0a0fa2a84a1a6579e4877 (diff)
New upstream version 1.14.4.upstream/1.14.4
Diffstat (limited to 'gallery_dl/extractor/imgur.py')
-rw-r--r--gallery_dl/extractor/imgur.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/gallery_dl/extractor/imgur.py b/gallery_dl/extractor/imgur.py
index a617975..25328ab 100644
--- a/gallery_dl/extractor/imgur.py
+++ b/gallery_dl/extractor/imgur.py
@@ -332,9 +332,15 @@ class ImgurAPI():
return self._call("image/" + image_hash)
def _call(self, endpoint):
- return self.extractor.request(
- "https://api.imgur.com/3/" + endpoint, headers=self.headers,
- ).json()["data"]
+ try:
+ return self.extractor.request(
+ "https://api.imgur.com/3/" + endpoint, headers=self.headers,
+ ).json()["data"]
+ except exception.HttpError as exc:
+ if exc.status != 403 or b"capacity" not in exc.response.content:
+ raise
+ self.extractor.sleep(seconds=600)
+ return self._call(endpoint)
def _pagination(self, endpoint):
num = 0