Overview
TheTweet class represents a Twitter/X post and provides methods for interacting with tweets such as replying, retweeting, favoriting, and more.
Tweet Class
Attributes
The unique identifier of the tweet.
The date and time when the tweet was created.
The created_at converted to datetime object.
Author of the tweet.
The full text of the tweet.
The full text of the tweet including note tweet content if available.
The language of the tweet.
The tweet ID this tweet is in reply to, if any.
Indicates if the tweet is a quote status.
The Tweet being quoted (if any).
The Tweet being retweeted (if any).
Indicates if the tweet content may be sensitive.
Indicates if the tweet’s sensitivity can be edited.
The count of quotes for the tweet.
The count of replies to the tweet.
The count of favorites or likes for the tweet.
Indicates if the tweet is favorited by the authenticated user.
The count of views.
The state of the tweet views.
The count of retweets for the tweet.
The count of bookmarks for the tweet.
Indicates if the tweet is bookmarked by the authenticated user.
A list of media entities associated with the tweet. See the media documentation for more details.Example: Download tweet media
The location associated with the tweet.
The timestamp until which the tweet is editable.
Indicates if the tweet is translatable.
Indicates if the tweet is eligible for editing.
The remaining number of edits allowed for the tweet.
List of tweet IDs representing the edit history of the tweet.
Replies to the tweet.
A list of Tweet objects representing the tweets to which this tweet replied.
Related tweets.
Hashtags included in the tweet text.
Indicates if the tweet contains a card.
The title of the webpage displayed inside tweet’s card.
Link to the image displayed in the tweet’s card.
Information about URLs contained in the tweet.
Poll associated with the tweet, if any.
Community note attached to the tweet, containing ‘id’ and ‘text’ fields.
Indicates if the tweet has community notes.
Methods
delete()
Deletes the tweet. Returns:httpx.Response
favorite()
Favorites (likes) the tweet. Returns:httpx.Response
unfavorite()
Unfavorites (unlikes) the tweet. Returns:httpx.Response
retweet()
Retweets the tweet. Returns:httpx.Response
delete_retweet()
Deletes the retweet. Returns:httpx.Response
bookmark()
Adds the tweet to bookmarks. Returns:httpx.Response
delete_bookmark()
Removes the tweet from bookmarks. Returns:httpx.Response
reply()
Replies to the tweet.The text content of the reply.
A list of media IDs or URIs to attach to the reply. Media IDs can be obtained by using the
upload_media method.Tweet - The created tweet.
get_retweeters()
Retrieve users who retweeted the tweet.The maximum number of users to retrieve.
A string indicating the position of the cursor for pagination.
Result[User] - A list of users who retweeted the tweet.
get_favoriters()
Retrieve users who favorited the tweet.The maximum number of users to retrieve.
A string indicating the position of the cursor for pagination.
Result[User] - A list of users who favorited the tweet.
get_similar_tweets()
Retrieves tweets similar to the tweet (Twitter premium only). Returns:list[Tweet] - A list of Tweet objects representing tweets similar to the tweet.
update()
Updates the tweet object with fresh data from the API.Poll Class
Represents a poll associated with a tweet.Attributes
The tweet associated with the poll.
The unique identifier of the poll.
The name of the poll.
A list containing dictionaries representing poll choices. Each dictionary contains ‘number’, ‘label’, and ‘count’ keys for choice information.
The duration of the poll in minutes.
The end date and time of the poll in UTC format.
The last updated date and time of the poll in UTC format.
Number of the selected choice.
Indicates if the poll counts are final.
Methods
vote()
Vote on the poll with the specified selected choice.The label of the selected choice for the vote.
Poll - The Poll object representing the updated poll after voting.
ScheduledTweet Class
Represents a scheduled tweet.Attributes
The unique identifier of the scheduled tweet.
The timestamp when the tweet is scheduled to be posted.
The state of the scheduled tweet.
The type of the tweet.
The text content of the scheduled tweet.
A list of media entities to be included in the tweet.
Methods
delete()
Delete the scheduled tweet. Returns:httpx.Response
CommunityNote Class
Represents a community note on a tweet.Attributes
The ID of the community note.
The text content of the community note.
A list of tags indicating misleading information.
Indicates if the sources are trustworthy.
A list of tags indicating helpful information.
The timestamp when the note was created.
Indicates if the note can be appealed.
The status of the appeal.
Indicates if the note is related to media content.
Matches related to media content.
Birdwatch profile associated with the note.
The ID of the tweet associated with the note.
