Skip to content

Commit 1b47483

Browse files
committed
fix accessing 'self.exc' in …API methods
fixes regression introduced in 53cdfaa
1 parent 98c5922 commit 1b47483

25 files changed

+60
-45
lines changed

gallery_dl/extractor/arcalive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _call(self, endpoint, params=None):
173173
msg = "API request failed: " + msg
174174
else:
175175
msg = "API request failed"
176-
raise self.exc.AbortExtraction(msg)
176+
raise self.extractor.exc.AbortExtraction(msg)
177177

178178
def _pagination(self, endpoint, params, key):
179179
while True:

gallery_dl/extractor/bilibili.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def articles(self):
116116
class BilibiliAPI():
117117
def __init__(self, extractor):
118118
self.extractor = extractor
119+
self.exc = extractor.exc
119120

120121
def _call(self, endpoint, params):
121122
url = "https://api.bilibili.com/x/polymer/web-dynamic/v1" + endpoint

gallery_dl/extractor/bluesky.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright 2024-2025 Mike Fährmann
3+
# Copyright 2024-2026 Mike Fährmann
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 as
@@ -569,7 +569,7 @@ def _authenticate_impl(self, username):
569569

570570
if response.status_code != 200:
571571
self.log.debug("Server response: %s", data)
572-
raise self.exc.AuthenticationError(
572+
raise self.extractor.exc.AuthenticationError(
573573
f"\"{data.get('error')}: {data.get('message')}\"")
574574

575575
_refresh_token_cache.update(self.username, data["refreshJwt"])
@@ -600,7 +600,7 @@ def _call(self, endpoint, params, root=None):
600600
msg = f"{msg} ({response.status_code} {response.reason})"
601601

602602
self.extractor.log.debug("Server response: %s", response.text)
603-
raise self.exc.AbortExtraction(msg)
603+
raise self.extractor.exc.AbortExtraction(msg)
604604

605605
def _pagination(self, endpoint, params,
606606
key="feed", root=None, check_empty=False):

gallery_dl/extractor/boosty.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,15 @@ def _call(self, endpoint, params=None):
380380
return response.json()
381381

382382
elif response.status_code < 400:
383-
raise self.exc.AuthenticationError("Invalid API access token")
383+
raise self.extractor.exc.AuthenticationError(
384+
"Invalid API access token")
384385

385386
elif response.status_code == 429:
386387
self.extractor.wait(seconds=600)
387388

388389
else:
389390
self.extractor.log.debug(response.text)
390-
raise self.exc.AbortExtraction("API request failed")
391+
raise self.extractor.exc.AbortExtraction("API request failed")
391392

392393
def _pagination(self, endpoint, params, transform=None, key=None):
393394
if "is_only_allowed" not in params and self.extractor.only_allowed:

gallery_dl/extractor/civitai.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright 2024-2025 Mike Fährmann
3+
# Copyright 2024-2026 Mike Fährmann
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 as
@@ -201,7 +201,8 @@ def _require_auth(self):
201201
if "Authorization" not in self.api.headers and \
202202
not self.cookies.get(
203203
"__Secure-civitai-token", domain=".civitai.com"):
204-
raise self.exc.AuthRequired(("api-key", "authenticated cookies"))
204+
raise self.extractor.exc.AuthRequired(
205+
("api-key", "authenticated cookies"))
205206

206207
def _parse_query(self, value):
207208
return text.parse_query_list(

gallery_dl/extractor/deviantart.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,7 @@ class DeviantartOAuthAPI():
11871187
def __init__(self, extractor):
11881188
self.extractor = extractor
11891189
self.log = extractor.log
1190+
self.exc = extractor.exc
11901191
self.headers = {"dA-minor-version": "20210526"}
11911192
self._warn_429 = True
11921193

@@ -1808,7 +1809,7 @@ def _ids_watching(self, user):
18081809

18091810
pos = page.find('\\"name\\":\\"watching\\"')
18101811
if pos < 0:
1811-
raise self.exc.NotFoundError("'watching' module ID")
1812+
raise self.extractor.exc.NotFoundError("'watching' module ID")
18121813
module_id = text.rextr(page, '\\"id\\":', ',', pos).strip('" ')
18131814

18141815
self._fetch_csrf_token(page)

gallery_dl/extractor/discord.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ def _pagination(self, method, batch):
490490
offset += len(data)
491491

492492
def _raise_invalid_token(self):
493-
raise self.exc.AuthenticationError("""Invalid or missing token.
493+
raise self.extractor.exc.AuthenticationError("""\
494+
Invalid or missing token.
494495
Please provide a valid token following these instructions:
495496
496497
1) Open Discord in your browser (https://discord.com/app);

gallery_dl/extractor/imagechest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
# Copyright 2020 Leonid "Bepis" Pavel
4-
# Copyright 2023-2025 Mike Fährmann
4+
# Copyright 2023-2026 Mike Fährmann
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License version 2 as
@@ -142,11 +142,12 @@ def _call(self, endpoint):
142142
return response.json()["data"]
143143

144144
elif response.status_code < 400:
145-
raise self.exc.AuthenticationError("Invalid API access token")
145+
raise self.extractor.exc.AuthenticationError(
146+
"Invalid API access token")
146147

147148
elif response.status_code == 429:
148149
self.extractor.wait(seconds=600)
149150

150151
else:
151152
self.extractor.log.debug(response.text)
152-
raise self.exc.AbortExtraction("API request failed")
153+
raise self.extractor.exc.AbortExtraction("API request failed")

gallery_dl/extractor/inkbunny.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright 2020-2025 Mike Fährmann
3+
# Copyright 2020-2026 Mike Fährmann
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 as
@@ -348,7 +348,7 @@ def _call(self, endpoint, params):
348348
self.authenticate(invalidate=True)
349349
continue
350350

351-
raise self.exc.AbortExtraction(data.get("error_message"))
351+
raise self.extractor.exc.AbortExtraction(data.get("error_message"))
352352

353353
def _pagination_search(self, params):
354354
params["page"] = 1

gallery_dl/extractor/instagram.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ class InstagramRestAPI():
804804

805805
def __init__(self, extractor):
806806
self.extractor = extractor
807+
self.exc = extractor.exc
807808

808809
_cache = self.extractor.config("user-cache", True)
809810
_cache = memcache if not _cache or _cache == "memory" else cache
@@ -1087,7 +1088,8 @@ def __init__(self, extractor):
10871088
self.user_id = api.user_id
10881089

10891090
def _unsupported(self, _=None):
1090-
raise self.exc.AbortExtraction("Unsupported with GraphQL API")
1091+
raise self.extractor.exc.AbortExtraction(
1092+
"Unsupported with GraphQL API")
10911093

10921094
def highlights_tray(self, user_id):
10931095
query_hash = "d4d88dc1500312af6f937f7b804c68c3"

0 commit comments

Comments
 (0)