fix: add BannedAccount error
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user