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

[bluesky] improve API error messages

This commit is contained in:
Mike Fährmann 2024-02-28 14:45:36 +01:00
parent d921d860f1
commit 7d874e2497
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -447,10 +447,16 @@ class BlueskyAPI():
self.extractor.wait(seconds=60) self.extractor.wait(seconds=60)
continue continue
try:
data = response.json()
msg = "API request failed ('{}: {}')".format(
data["error"], data["message"])
except Exception:
msg = "API request failed ({} {})".format(
response.status_code, response.reason)
self.extractor.log.debug("Server response: %s", response.text) self.extractor.log.debug("Server response: %s", response.text)
raise exception.StopExtraction( raise exception.StopExtraction(msg)
"API request failed (%s %s)",
response.status_code, response.reason)
def _pagination(self, endpoint, params, key="feed"): def _pagination(self, endpoint, params, key="feed"):
while True: while True: