feat: add profiel required exception; add spans to post
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, AccountBanned
|
||||
from itd.exceptions import InvalidToken, InvalidCookie, RateLimitExceeded, Unauthorized, AccountBanned, ProfileRequired
|
||||
|
||||
s = Session()
|
||||
|
||||
@@ -41,6 +41,8 @@ def fetch(token: str, method: str, url: str, params: dict = {}, files: dict[str,
|
||||
raise Unauthorized()
|
||||
if res.json().get('error', {}).get('code') == 'ACCOUNT_BANNED':
|
||||
raise AccountBanned()
|
||||
if res.json().get('error', {}).get('code') == 'PROFILE_REQUIRED':
|
||||
raise ProfileRequired()
|
||||
except (JSONDecodeError, AttributeError):
|
||||
pass # todo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user