[inkbunny] retry API calls with a loop instead of recursion

pull/5543/head
Mike Fährmann 5 months ago
parent 8ed70b3256
commit 619bf5c644
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -330,15 +330,18 @@ class InkbunnyAPI():
def _call(self, endpoint, params):
url = "https://inkbunny.net/api_" + endpoint + ".php"
params["sid"] = self.session_id
data = self.extractor.request(url, params=params).json()
if "error_code" in data:
while True:
data = self.extractor.request(url, params=params).json()
if "error_code" not in data:
return data
if str(data["error_code"]) == "2":
self.authenticate(invalidate=True)
return self._call(endpoint, params)
raise exception.StopExtraction(data.get("error_message"))
continue
return data
raise exception.StopExtraction(data.get("error_message"))
def _pagination_search(self, params):
params["page"] = 1

Loading…
Cancel
Save