add more info to error messages

This commit is contained in:
Trevor Hobenshield
2024-04-05 11:35:50 -07:00
parent 64ade2a39f
commit 38ff8da688
3 changed files with 10 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
__title__ = "twitter-api-client"
__description__ = "Implementation of X/Twitter v1, v2, and GraphQL APIs."
__version__ = "0.10.18"
__version__ = "0.10.19"
__author__ = "Trevor Hobenshield"
__license__ = "MIT"

View File

@@ -17,6 +17,7 @@ BLACK = '\x1b[30m'
RED = '\x1b[31m'
GREEN = '\x1b[32m'
YELLOW = '\x1b[33m'
ORANGE = '\x1b[38;5;208m'
BLUE = '\x1b[34m'
MAGENTA = '\x1b[35m'
CYAN = '\x1b[36m'

View File

@@ -9,8 +9,9 @@ import aiofiles
import orjson
from aiofiles.os import makedirs
from httpx import Response, Client
from textwrap import dedent
from .constants import GREEN, MAGENTA, RED, RESET, MAX_GQL_CHAR_LIMIT, USER_AGENTS
from .constants import GREEN, MAGENTA, RED, RESET, MAX_GQL_CHAR_LIMIT, USER_AGENTS, ORANGE
def init_session():
@@ -88,6 +89,12 @@ def get_json(res: list[Response], **kwargs) -> list:
results.append(data)
except Exception as e:
print('Cannot parse JSON response', e)
print(dedent(f'''{ORANGE}
Checklist:
1. Log-in via the browser and confirm your account is not blocked, or has pending security challenges.
2. Copy the `ct0` and `auth_token` cookies from the browser.
3. Re-run your program using these new cookies.
{RESET}'''))
return results