mirror of
https://github.com/Yuvi9587/Kemono-Downloader.git
synced 2025-12-29 16:14:44 +00:00
Deviant Support fix
This commit is contained in:
parent
50ba60a461
commit
5a8c151c97
@ -67,9 +67,7 @@ class DeviantArtClient:
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
resp = self.session.get(url, params=params, timeout=20)
|
resp = self.session.get(url, params=params, timeout=20)
|
||||||
|
|
||||||
# --- Handle Status Codes ---
|
|
||||||
|
|
||||||
# 429: Rate Limit (Retry infinitely like 1.py)
|
# 429: Rate Limit (Retry infinitely like 1.py)
|
||||||
if resp.status_code == 429:
|
if resp.status_code == 429:
|
||||||
retry_after = resp.headers.get('Retry-After')
|
retry_after = resp.headers.get('Retry-After')
|
||||||
@ -91,26 +89,20 @@ class DeviantArtClient:
|
|||||||
else:
|
else:
|
||||||
raise Exception("Failed to refresh token")
|
raise Exception("Failed to refresh token")
|
||||||
|
|
||||||
# 400, 403, 404: Client Errors (DO NOT RETRY)
|
|
||||||
# These mean the file doesn't exist or isn't downloadable via this endpoint.
|
|
||||||
if 400 <= resp.status_code < 500:
|
if 400 <= resp.status_code < 500:
|
||||||
resp.raise_for_status() # This raises immediately, breaking the loop
|
resp.raise_for_status() # This raises immediately, breaking the loop
|
||||||
|
|
||||||
# 5xx: Server Errors (Retry)
|
|
||||||
if 500 <= resp.status_code < 600:
|
if 500 <= resp.status_code < 600:
|
||||||
resp.raise_for_status() # Will be caught by except block below for retry
|
resp.raise_for_status()
|
||||||
|
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
|
|
||||||
# Success - Clear logs
|
|
||||||
with self.log_lock:
|
with self.log_lock:
|
||||||
self.logged_waits.clear()
|
self.logged_waits.clear()
|
||||||
|
|
||||||
return resp.json()
|
return resp.json()
|
||||||
|
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
# If it's a 4xx error (caught above), re-raise it immediately
|
|
||||||
# so get_deviation_content can switch to fallback logic.
|
|
||||||
if e.response is not None and 400 <= e.response.status_code < 500:
|
if e.response is not None and 400 <= e.response.status_code < 500:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user