SlyTwitter.twitter_v2#

Twitter API v2

Classes

Scope()

TweetField(value[, names, module, qualname, ...])

TwitterV2(auth)

User(source)

UserField(value[, names, module, qualname, ...])

class SlyTwitter.twitter_v2.Scope[source]#

Bases: object

USERS_READ = 'users.read'#
TWEETS_READ = 'tweets.read'#
FOLLOWS_READ = 'follows.read'#
class SlyTwitter.twitter_v2.TweetField(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

ATTACHMENTS = 'attachments'#
AUTHOR_ID = 'author_id'#
CONTEXT_ANNOTATIONS = 'context_annotations'#
CONVERSATION_ID = 'conversation_id'#
CREATED_AT = 'created_at'#
ENTITIES = 'entities'#
GEO = 'geo'#
ID = 'id'#
IN_REPLY_TO_USER_ID = 'in_reply_to_user_id'#
LANG = 'lang'#
NON_PUBLIC_METRICS = 'non_public_metrics'#
ORGANIC_METRICS = 'organic_metrics'#
PROMOTED_METRICS = 'promoted_metrics'#
PUBLIC_METRICS = 'public_metrics'#
PULICATIONS = 'publications'#
REFERENCED_TWEETS = 'referenced_tweets'#
REPLY_SETTINGS = 'reply_settings'#
SOURCE = 'source'#
TEXT = 'text'#
WITHHELD = 'withheld'#
class SlyTwitter.twitter_v2.UserField(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

CREATED_AT = 'created_at'#
DESCRIPTION = 'description'#
ENTITIES = 'entities'#
ID = 'id'#
LOCATION = 'location'#
NAME = 'name'#
PINNED_TWEET_ID = 'pinned_tweet_id'#
PROFILE_IMAGE_URL = 'profile_image_url'#
PROTECTED = 'protected'#
PUBLIC_METRICS = 'public_metrics'#
URL = 'url'#
USERNAME = 'username'#
VERIFIED = 'verified'#
WITHHELD = 'withheld'#
class SlyTwitter.twitter_v2.User(source)[source]#

Bases: object

Parameters:

source (Any) –

id: int#
at: str#
display_name: str#
class SlyTwitter.twitter_v2.TwitterV2(auth)[source]#

Bases: WebAPI

Parameters:

auth (OAuth2) –

base_url: str = 'https://api.twitter.com/2/'#
await me()[source]#

The currently authenticated user.

Return type:

User

await user(at=None)[source]#

Get a user by their @username.

Parameters:

at (str | None) –

Return type:

User

await all_followers_of(user)[source]#

Get the list of users following a user.

Parameters:

user (User) –

Return type:

AsyncTrans[User]

await all_followed_by(user)[source]#

Get the list of followed users by a user.

Parameters:

user (User) –

Return type:

AsyncTrans[User]