Commit 53d7ee30 authored by Raphael Beer's avatar Raphael Beer

Fix: using types for hints direclty is not available python<3.9

parent 26f6f11f
from typing import Any
import sys
import pathlib
from typing import Any, Tuple, Dict
sys.path.insert(0, str(pathlib.Path(__file__).parent))
from features import count_sensitives
from log import log
from twitter_session import TwitterSession, UnexpectedApiError
from util import is_error, is_generic_error
from util import is_error, is_generic_error, UnexpectedApiError
async def test(session: TwitterSession, username: str) -> tuple[str, dict[str, Any]]:
async def test(session, username: str) -> Tuple[str, Dict[str, Any]]:
profile: dict[str, Any] = {}
profile_raw = await session.profile_raw(username)
log.info('Testing ' + str(username))
......
......@@ -9,10 +9,7 @@ from yarl import URL
from log import log
from tests import *
from util import get_nested, is_error
class UnexpectedApiError(Exception):
pass
from util import get_nested, is_error, UnexpectedApiError
class TwitterSession:
twitter_auth_key = ''
......
......@@ -30,3 +30,6 @@ def get_ordered_tweet_ids(obj, filtered=True):
entries.sort(key=lambda x: -int(x["sortIndex"]))
flat = flatten_timeline(entries)
return [x for x in flat if not filtered or x in obj["globalObjects"]["tweets"]]
class UnexpectedApiError(Exception):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment