fix: add BannedAccount error

This commit is contained in:
firedotguy
2026-02-12 18:25:25 +03:00
parent 7cc343dab5
commit c1042d32ae
4 changed files with 12 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ from _io import BufferedReader
from requests import Session
from requests.exceptions import JSONDecodeError
from itd.exceptions import InvalidToken, InvalidCookie, RateLimitExceeded, Unauthorized
from itd.exceptions import InvalidToken, InvalidCookie, RateLimitExceeded, Unauthorized, AccountBanned
s = Session()
@@ -39,6 +39,8 @@ def fetch(token: str, method: str, url: str, params: dict = {}, files: dict[str,
raise RateLimitExceeded(res.json()['error'].get('retryAfter', 0))
if res.json().get('error', {}).get('code') == 'UNAUTHORIZED':
raise Unauthorized()
if res.json().get('error', {}).get('code') == 'ACCOUNT_BANNED':
raise AccountBanned()
except (JSONDecodeError, AttributeError):
pass # todo