This page contains some basic documentation for the Tweepy module.
This class provides a wrapper for the API as provided by Twitter. The functions provided in this class are listed below.
Parameters: |
|
---|
Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user’s friends. This is the equivalent of /timeline/home on the Web.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns the 20 most recent statuses posted by the authenticating user and that user’s friends.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns: list of Status objects
Returns the 20 most recent statuses posted from the authenticating user or the user specified. It’s also possible to request another user’s timeline via the id parameter.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns the 20 most recent mentions (status containing @username) for the authenticating user.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns the 20 most recent retweets posted by the authenticating user.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns the 20 most recent retweets posted by the authenticating user’s friends.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns a single status specified by the ID parameter.
Parameters: | id – The numerical ID of the status. |
---|---|
Return type: | Status object |
Update the authenticated user’s status. Statuses that are duplicates or too long will be silently ignored.
Parameters: |
|
---|---|
Return type: | Status object |
Update the authenticated user’s status. Statuses that are duplicates or too long will be silently ignored.
Parameters: |
|
---|---|
Return type: | Status object |
Destroy the status specified by the id parameter. The authenticated user must be the author of the status to destroy.
Parameters: | id – The numerical ID of the status. |
---|---|
Return type: | Status object |
Retweets a tweet. Requires the id of the tweet you are retweeting.
Parameters: | id – The numerical ID of the status. |
---|---|
Return type: | Status object |
Returns up to 100 of the first retweets of the given tweet.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Returns information about the specified user.
Parameters: |
|
---|---|
Return type: | User object |
Returns the authenticated user’s information.
Return type: | User object |
---|
Returns an user’s followers ordered in which they were added 100 at a time. If no user is specified by id/screen name, it defaults to the authenticated user.
Parameters: |
|
---|---|
Return type: | list of User objects |
Run a search for users similar to Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this API (about being listed in the People Search). It is only possible to retrieve the first 1000 matches from this API.
Parameters: |
|
---|---|
Return type: | list of User objects |
Returns direct messages sent to the authenticating user.
Parameters: |
|
---|---|
Return type: | list of DirectMessage objects |
Returns direct messages sent by the authenticating user.
Parameters: |
|
---|---|
Return type: | list of DirectMessage objects |
Sends a new direct message to the specified user from the authenticating user.
Parameters: |
|
---|---|
Return type: | DirectMessage object |
Destroy a direct message. Authenticating user must be the recipient of the direct message.
Parameters: | id – The ID of the direct message to destroy. |
---|---|
Return type: | DirectMessage object |
Create a new friendship with the specified user (aka follow).
Parameters: |
|
---|---|
Return type: | User object |
Destroy a friendship with the specified user (aka unfollow).
Parameters: |
|
---|---|
Return type: | User object |
Checks if a friendship exists between two users. Will return True if user_a follows user_b, otherwise False.
Parameters: |
|
---|---|
Return type: | True/False |
Returns detailed information about the relationship between two users.
Parameters: |
|
---|---|
Return type: | Friendship object |
Returns an array containing the IDs of users being followed by the specified user.
Parameters: |
|
---|---|
Return type: | list of Integers |
Returns an array containing the IDs of users following the specified user.
Parameters: |
|
---|---|
Return type: | list of Integers |
Verify the supplied user credentials are valid.
Return type: | User object if credentials are valid, otherwise False |
---|
Returns the remaining number of API requests available to the requesting user before the API limit is reached for the current hour. Calls to rate_limit_status do not count against the rate limit. If authentication credentials are provided, the rate limit status for the authenticating user is returned. Otherwise, the rate limit status for the requester’s IP address is returned.
Return type: | JSON object |
---|
Sets which device Twitter delivers updates to for the authenticating user. Sending “none” as the device parameter will disable SMS updates.
Parameters: | device – Must be one of: sms, none |
---|---|
Return type: | User object |
Sets one or more hex values that control the color scheme of the authenticating user’s profile page on twitter.com.
Parameters: |
|
---|---|
Return type: | User object |
Update the authenticating user’s profile image. Valid formats: GIF, JPG, or PNG
Parameters: | filename – local path to image file to upload. Not a remote URL! |
---|---|
Return type: | User object |
Update authenticating user’s background image. Valid formats: GIF, JPG, or PNG
Parameters: | filename – local path to image file to upload. Not a remote URL! |
---|---|
Return type: | User object |
Sets values that users are able to set under the “Account” tab of their settings page.
Parameters: |
|
---|---|
Return type: | User object |
Returns the favorite statuses for the authenticating user or user specified by the ID parameter.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Favorites the status specified in the ID parameter as the authenticating user.
Parameters: | id – The numerical ID of the status. |
---|---|
Return type: | Status object |
Un-favorites the status specified in the ID parameter as the authenticating user.
Parameters: | id – The numerical ID of the status. |
---|---|
Return type: | Status object |
Enables device notifications for updates from the specified user.
Parameters: |
|
---|---|
Return type: | User object |
Disables notifications for updates from the specified user to the authenticating user.
Parameters: |
|
---|---|
Return type: | User object |
Blocks the user specified in the ID parameter as the authenticating user. Destroys a friendship to the blocked user if it exists.
Parameters: |
|
---|---|
Return type: | User object |
Un-blocks the user specified in the ID parameter for the authenticating user.
Parameters: |
|
---|---|
Return type: | User object |
Checks if the authenticated user is blocking the specified user.
Parameters: |
|
---|---|
Return type: | True/False |
Returns an array of user objects that the authenticating user is blocking.
Parameters: | page – Specifies the page of results to retrieve. Note: there are pagination limits. |
---|---|
Return type: | list of User objects |
Returns an array of numeric user ids the authenticating user is blocking.
Return type: | list of Integers |
---|
The user specified in the id is blocked by the authenticated user and reported as a spammer.
Parameters: |
|
---|---|
Return type: | User object |
Returns the authenticated user’s saved search queries.
Return type: | list of SavedSearch objects |
---|
Retrieve the data for a saved search owned by the authenticating user specified by the given id.
Parameters: | id – The id of the saved search to be retrieved. |
---|---|
Return type: | SavedSearch object |
Creates a saved search for the authenticated user.
Parameters: | query – The query of the search the user would like to save. |
---|---|
Return type: | SavedSearch object |
Destroys a saved search for the authenticated user. The search specified by id must be owned by the authenticating user.
Parameters: | id – The id of the saved search to be deleted. |
---|---|
Return type: | SavedSearch object |
Returns tweets that match a specified query.
Parameters: |
|
---|---|
Return type: | list of SearchResult objects |
Returns the top ten topics that are currently trending on Twitter. The response includes the time of the request, the name of each trend, and the url to the Twitter Search results page for that topic.
Return type: | JSON object |
---|
Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
Parameters: | exclude – Setting this equal to hashtags will remove all hashtags from the trends list. |
---|---|
Return type: | JSON object |
Returns the top 20 trending topics for each hour in a given day.
Parameters: |
|
---|---|
Return type: | JSON object |
Returns the top 30 trending topics for each day in a given week.
Parameters: |
|
---|---|
Return type: | JSON object |
Creates a new list for the authenticated user. Accounts are limited to 20 lists.
Parameters: |
|
---|---|
Return type: | List object |
Deletes the specified list. Must be owned by the authenticated user.
Parameters: | slug – the slug name or numerical ID of the list |
---|---|
Return type: | List object |
Updates the specified list. Note: this current throws a 500. Twitter is looking into the issue.
Parameters: |
|
---|---|
Return type: | List object |
List the lists of the specified user. Private lists will be included if the authenticated users is the same as the user who’s lists are being returned.
Parameters: | cursor – Breaks the results into pages. Provide a value of -1 to begin paging. Provide values as returned to in the response body’s next_cursor and previous_cursor attributes to page back and forth in the list. |
---|---|
Return type: | list of List objects |
List the lists the specified user has been added to.
Parameters: | cursor – Breaks the results into pages. Provide a value of -1 to begin paging. Provide values as returned to in the response body’s next_cursor and previous_cursor attributes to page back and forth in the list. |
---|---|
Return type: | list of List objects |
List the lists the specified user follows.
Parameters: | cursor – Breaks the results into pages. Provide a value of -1 to begin paging. Provide values as returned to in the response body’s next_cursor and previous_cursor attributes to page back and forth in the list. |
---|---|
Return type: | list of List objects |
Show tweet timeline for members of the specified list.
Parameters: |
|
---|---|
Return type: | list of Status objects |
Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
Parameters: |
|
---|---|
Return type: | List object |
Add a member to a list. The authenticated user must own the list to be able to add members to it. Lists are limited to having 500 members.
Parameters: |
|
---|---|
Return type: | List object |
Removes the specified member from the list. The authenticated user must be the list’s owner to remove members from the list.
Parameters: |
|
---|---|
Return type: | List object |
Returns the members of the specified list.
Parameters: |
|
---|---|
Return type: | list of User objects |
Check if a user is a member of the specified list.
Parameters: |
|
---|---|
Return type: | User object if user is a member of list, otherwise False. |
Make the authenticated user follow the specified list.
Parameters: |
|
---|---|
Return type: | List object |
Unsubscribes the authenticated user form the specified list.
Parameters: |
|
---|---|
Return type: | List object |
Returns the subscribers of the specified list.
Parameters: |
|
---|---|
Return type: | list of User objects |
Check if the specified user is a subscriber of the specified list.
Parameters: |
|
---|---|
Return type: | User object if user is subscribed to the list, otherwise False. |
Returns the locations that Twitter has trending topic information for. The response is an array of “locations” that encode the location’s WOEID (a Yahoo! Where On Earth ID) and some other human-readable information such as a canonical name and country the location belongs in. [Coming soon]
Parameters: |
|
---|---|
Return type: | JSON object |
Returns the top 10 trending topics for a specific location Twitter has trending topic information for. The response is an array of “trend” objects that encode the name of the trending topic, the query parameter that can be used to search for the topic on Search, and the direct URL that can be issued against Search. This information is cached for five minutes, and therefore users are discouraged from querying these endpoints faster than once every five minutes. Global trends information is also available from this API by using a WOEID of 1.
Parameters: | woeid –
|
---|---|
Return type: | JSON object |
Given a latitude and longitude, looks for places (cities and neighbourhoods) whose IDs can be specified in a call to update_status() to appear as the name of the location. This call provides a detailed response about the location in question; the nearby_places() function should be preferred for getting a list of places nearby without great detail.
Parameters: |
|
---|
Given a latitude and longitude, looks for nearby places (cities and neighbourhoods) whose IDs can be specified in a call to update_status() to appear as the name of the location. This call provides a detailed response about the location in question; the nearby_places() function should be preferred for getting a list of places nearby without great detail.
Parameters: |
|
---|
Given id of a place, provide more details about that place.
Parameters: | id – Valid Twitter ID of a location. |
---|