feat: add profiel required exception; add spans to post

This commit is contained in:
firedotguy
2026-02-13 22:38:28 +03:00
parent b3b109613b
commit 6edc40308a
3 changed files with 22 additions and 8 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, 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