Python: module twitter

twitter (version 0.8) | index twitter.py

`A library that provides a Python interface to the Twitter API`

Modules
`` |  |
StringIO base64 calendar datetime gzip | httplib oauth2 os rfc822 json | sys tempfile textwrap time urllib | urllib2 urlparse

Classes
`` |  | __builtin__.object Api DirectMessage Hashtag List Status Trend Url User exceptions.Exception(exceptions.BaseException) TwitterError
class Api(__builtin__.object)
`` | `A python interface into the Twitter API By default, the Api caches results for 1 minute. Example usage: To create an instance of the twitter.Api class, with no authentication: >>> import twitter >>> api = twitter.Api() To fetch a single user's public status messages, where "user" is either a Twitter "short name" or their user id. >>> statuses = api.GetUserTimeline(user) >>> print [s.text for s in statuses] To use authentication, instantiate the twitter.Api class with a consumer key and secret; and the oAuth key and secret: >>> api = twitter.Api(consumer_key='twitter consumer key', consumer_secret='twitter consumer secret', access_token_key='the_key_given', access_token_secret='the_key_secret') To fetch your friends (after being authenticated): >>> users = api.GetFriends() >>> print [u.name for u in users] To post a twitter status message (after being authenticated): >>> status = api.PostUpdate('I love python-twitter!') >>> print status.text I love python-twitter! There are many other methods, including: >>> api.PostUpdates(status) >>> api.PostDirectMessage(user, text) >>> api.GetUser(user) >>> api.GetReplies() >>> api.GetUserTimeline(user) >>> api.GetStatus(id) >>> api.DestroyStatus(id) >>> api.GetFriends(user) >>> api.GetFollowers() >>> api.GetFeatured() >>> api.GetDirectMessages() >>> api.PostDirectMessage(user, text) >>> api.DestroyDirectMessage(id) >>> api.DestroyFriendship(user) >>> api.CreateFriendship(user) >>> api.VerifyCredentials()`
| Methods defined here: ClearCredentials(self) `Clear the any credentials for this instance` CreateFavorite(self, status) `Favorites the status specified in the status parameter as the authenticating user. Returns the favorite status when successful. The twitter.Api instance must be authenticated. Args: The twitter.Status instance to mark as a favorite. Returns: A twitter.Status instance representing the newly-marked favorite.` CreateFriendship(self, user) `Befriends the user specified in the user parameter as the authenticating user. The twitter.Api instance must be authenticated. Args: The ID or screen name of the user to befriend. Returns: A twitter.User instance representing the befriended user.` CreateList(self, user, name, mode=None, description=None) `Creates a new list with the given name The twitter.Api instance must be authenticated. Args: user: Twitter name to create the list for name: New name for the list mode: 'public' or 'private'. Defaults to 'public'. [Optional] description: Description of the list. [Optional] Returns: A twitter.List instance representing the new list` CreateSubscription(self, owner, list) `Creates a subscription to a list by the authenticated user The twitter.Api instance must be authenticated. Args: owner: User name or id of the owner of the list being subscribed to. list: The slug or list id to subscribe the user to Returns: A twitter.List instance representing the list subscribed to` DestroyDirectMessage(self, id) `Destroys the direct message specified in the required ID parameter. The twitter.Api instance must be authenticated, and the authenticating user must be the recipient of the specified direct message. Args: id: The id of the direct message to be destroyed Returns: A twitter.DirectMessage instance representing the message destroyed` DestroyFavorite(self, status) `Un-favorites the status specified in the ID parameter as the authenticating user. Returns the un-favorited status in the requested format when successful. The twitter.Api instance must be authenticated. Args: The twitter.Status to unmark as a favorite. Returns: A twitter.Status instance representing the newly-unmarked favorite.` DestroyFriendship(self, user) `Discontinues friendship with the user specified in the user parameter. The twitter.Api instance must be authenticated. Args: The ID or screen name of the user with whom to discontinue friendship. Returns: A twitter.User instance representing the discontinued friend.` DestroyList(self, user, id) `Destroys the list from the given user The twitter.Api instance must be authenticated. Args: user: The user to remove the list from. id: The slug or id of the list to remove. Returns: A twitter.List instance representing the removed list.` DestroyStatus(self, id) `Destroys the status specified by the required ID parameter. The twitter.Api instance must be authenticated and the authenticating user must be the author of the specified status. Args: id: The numerical ID of the status you're trying to destroy. Returns: A twitter.Status instance representing the destroyed status message` DestroySubscription(self, owner, list) `Destroys the subscription to a list for the authenticated user The twitter.Api instance must be authenticated. Args: owner: The user id or screen name of the user that owns the list that is to be unsubscribed from list: The slug or list id of the list to unsubscribe from Returns: A twitter.List instance representing the removed list.` FilterPublicTimeline(self, term, since_id=None) `Filter the public twitter timeline by a given search term on the local machine. Args: term: term to search by. since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] Returns: A sequence of twitter.Status instances, one for each message containing the term` GetDirectMessages(self, since=None, since_id=None, page=None) `Returns a list of the direct messages sent to the authenticating user. The twitter.Api instance must be authenticated. Args: since: Narrows the returned results to just those statuses created after the specified HTTP-formatted date. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] Returns: A sequence of twitter.DirectMessage instances` GetFavorites(self, user=None, page=None) `Return a list of Status objects representing favorited tweets. By default, returns the (up to) 20 most recent tweets for the authenticated user. Args: user: The twitter name or id of the user whose favorites you are fetching. If not specified, defaults to the authenticated user. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional]` GetFeatured(self) `Fetch the sequence of twitter.User instances featured on twitter.com The twitter.Api instance must be authenticated. Returns: A sequence of twitter.User instances` GetFollowerIDs(self, userid=None, cursor=-1) `Fetch the sequence of twitter.User instances, one for each follower The twitter.Api instance must be authenticated. Returns: A sequence of twitter.User instances, one for each follower` GetFollowers(self, page=None) `Fetch the sequence of twitter.User instances, one for each follower The twitter.Api instance must be authenticated. Args: page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] Returns: A sequence of twitter.User instances, one for each follower` GetFriendIDs(self, user=None, cursor=-1) `Returns a list of twitter user id's for every person the specified user is following. Args: user: The id or screen_name of the user to retrieve the id list for [Optional] Returns: A list of integers, one for each user id.` GetFriends(self, user=None, cursor=-1) `Fetch the sequence of twitter.User instances, one for each friend. The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user whose friends you are fetching. If not specified, defaults to the authenticated user. [Optional] Returns: A sequence of twitter.User instances, one for each friend` GetLists(self, user, cursor=-1) `Fetch the sequence of lists for a user. The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user whose friends you are fetching. If the passed in user is the same as the authenticated user then you will also receive private list data. cursor: "page" value that Twitter will use to start building the list sequence from. -1 to start at the beginning. Twitter will return in the result the values for next_cursor and previous_cursor. [Optional] Returns: A sequence of twitter.List instances, one for each list` GetMentions(self, since_id=None, max_id=None, page=None) `Returns the 20 most recent mentions (status containing @twitterID) for the authenticating user. Args: since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] max_id: Returns only statuses with an ID less than (that is, older than) the specified ID. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] Returns: A sequence of twitter.Status instances, one for each mention of the user.` GetRateLimitStatus(self) `Fetch the rate limit status for the currently authorized user. Returns: A dictionary containing the time the limit will reset (reset_time), the number of remaining hits allowed before the reset (remaining_hits), the number of hits allowed in a 60-minute period (hourly_limit), and the time of the reset in seconds since The Epoch (reset_time_in_seconds).` GetReplies(self, since=None, since_id=None, page=None) `Get a sequence of status messages representing the 20 most recent replies (status updates prefixed with @twitterID) to the authenticating user. Args: since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] since: Returns: A sequence of twitter.Status instances, one for each reply to the user.` GetRetweets(self, statusid) `Returns up to 100 of the first retweets of the tweet identified by statusid Args: statusid: The ID of the tweet for which retweets should be searched for Returns: A list of twitter.Status instances, which are retweets of statusid` GetSearch(self, term, geocode=None, since_id=None, per_page=15, page=1, lang='en', show_user='true', query_users=False) `Return twitter search results for a given term. Args: term: term to search by. since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] geocode: geolocation information in the form (latitude, longitude, radius) [Optional] per_page: number of results to return. Default is 15 [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] lang: language for results. Default is English [Optional] show_user: prefixes screen name in status query_users: If set to False, then all users only have screen_name and profile_image_url available. If set to True, all information of users are available, but it uses lots of request quota, one per status. Returns: A sequence of twitter.Status instances, one for each message containing the term` GetStatus(self, id) `Returns a single status message. The twitter.Api instance must be authenticated if the status message is private. Args: id: The numeric ID of the status you are trying to retrieve. Returns: A twitter.Status instance representing that status message` GetSubscriptions(self, user, cursor=-1) `Fetch the sequence of Lists that the given user is subscribed to The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user cursor: "page" value that Twitter will use to start building the list sequence from. -1 to start at the beginning. Twitter will return in the result the values for next_cursor and previous_cursor. [Optional] Returns: A sequence of twitter.List instances, one for each list` GetTrendsCurrent(self, exclude=None) `Get the current top trending topics Args: exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 10 entries. Each entry contains the twitter.` GetTrendsDaily(self, exclude=None, startdate=None) `Get the current top trending topics for each hour in a given day Args: startdate: The start date for the report. Should be in the format YYYY-MM-DD. [Optional] exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 24 entries. Each entry contains the twitter. Trend elements that were trending at the corresponding hour of the day.` GetTrendsWeekly(self, exclude=None, startdate=None) `Get the top 30 trending topics for each day in a given week. Args: startdate: The start date for the report. Should be in the format YYYY-MM-DD. [Optional] exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with each entry contains the twitter. Trend elements of trending topics for the corrsponding day of the week` GetUser(self, user) `Returns a single user. The twitter.Api instance must be authenticated. Args: user: The twitter name or id of the user to retrieve. Returns: A twitter.User instance representing that user` GetUserRetweets(self, count=None, since_id=None, max_id=None, include_entities=False) `Fetch the sequence of retweets made by a single user. The twitter.Api instance must be authenticated. Args: count: The number of status messages to retrieve. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] max_id: Returns results with an ID less than (that is, older than) or equal to the specified ID. [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] Returns: A sequence of twitter.Status instances, one for each message up to count` GetUserTimeline(self, id=None, user_id=None, screen_name=None, since_id=None, max_id=None, count=None, page=None, include_rts=None, include_entities=None) `Fetch the sequence of public Status messages for a single user. The twitter.Api instance must be authenticated if the user is private. Args: id: Specifies the ID or screen name of the user for whom to return the user_timeline. [Optional] user_id: Specfies the ID of the user for whom to return the user_timeline. Helpful for disambiguating when a valid user ID is also a valid screen name. [Optional] screen_name: Specfies the screen name of the user for whom to return the user_timeline. Helpful for disambiguating when a valid screen name is also a user ID. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] max_id: Returns only statuses with an ID less than (that is, older than) or equal to the specified ID. [Optional] count: Specifies the number of statuses to retrieve. May not be greater than 200. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] include_rts: If True, the timeline will contain native retweets (if they exist) in addition to the standard stream of tweets. [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] Returns: A sequence of Status instances, one for each message up to count` MaximumHitFrequency(self) `Determines the minimum number of seconds that a program must wait before hitting the server again without exceeding the rate_limit imposed for the currently authenticated user. Returns: The minimum second interval that a program must use so as to not exceed the rate_limit imposed for the user.` PostDirectMessage(self, user, text) `Post a twitter direct message from the authenticated user The twitter.Api instance must be authenticated. Args: user: The ID or screen name of the recipient user. text: The message text to be posted. Must be less than 140 characters. Returns: A twitter.DirectMessage instance representing the message posted` PostUpdate(self, status, in_reply_to_status_id=None) `Post a twitter status message from the authenticated user. The twitter.Api instance must be authenticated. Args: status: The message text to be posted. Must be less than or equal to 140 characters. in_reply_to_status_id: The ID of an existing status that the status to be posted is in reply to. This implicitly sets the in_reply_to_user_id attribute of the resulting status to the user ID of the message being replied to. Invalid/missing status IDs will be ignored. [Optional] Returns: A twitter.Status instance representing the message posted.` PostUpdates(self, status, continuation=None, **kwargs) `Post one or more twitter status messages from the authenticated user. Unlike api.PostUpdate, this method will post multiple status updates if the message is longer than 140 characters. The twitter.Api instance must be authenticated. Args: status: The message text to be posted. May be longer than 140 characters. continuation: The character string, if any, to be appended to all but the last message. Note that Twitter strips trailing '...' strings from messages. Consider using the unicode \u2026 character (horizontal ellipsis) instead. [Defaults to None] **kwargs: See api.PostUpdate for a list of accepted parameters. Returns: A of list twitter.Status instance representing the messages posted.` SetCache(self, cache) `Override the default cache. Set to None to prevent caching. Args: cache: An instance that supports the same API as the twitter._FileCache` SetCacheTimeout(self, cache_timeout) `Override the default cache timeout. Args: cache_timeout: Time, in seconds, that responses should be reused.` SetCredentials(self, consumer_key, consumer_secret, access_token_key=None, access_token_secret=None) `Set the consumer_key and consumer_secret for this instance Args: consumer_key: The consumer_key of the twitter account. consumer_secret: The consumer_secret for the twitter account. access_token_key: The oAuth access token key value you retrieved from running get_access_token.py. access_token_secret: The oAuth access token's secret, also retrieved from the get_access_token.py run.` SetSource(self, source) `Suggest the "from source" value to be displayed on the Twitter web site. The value of the 'source' parameter must be first recognized by the Twitter server. New source values are authorized on a case by case basis by the Twitter development team. Args: source: The source name as a string. Will be sent to the server as the 'source' parameter.` SetUrllib(self, urllib) `Override the default urllib implementation. Args: urllib: An instance that supports the same API as the urllib2 module` SetUserAgent(self, user_agent) `Override the default user agent Args: user_agent: A string that should be send to the server as the User-agent` SetXTwitterHeaders(self, client, url, version) `Set the X-Twitter HTTP headers that will be sent to the server. Args: client: The client name as a string. Will be sent to the server as the 'X-Twitter-Client' header. url: The URL of the meta.xml as a string. Will be sent to the server as the 'X-Twitter-Client-URL' header. version: The client version as a string. Will be sent to the server as the 'X-Twitter-Client-Version' header.` UsersLookup(self, user_id=None, screen_name=None, users=None) `Fetch extended information for the specified users. Users may be specified either as lists of either user_ids, screen_names, or twitter.User objects. The list of users that are queried is the union of all specified parameters. The twitter.Api instance must be authenticated. Args: user_id: A list of user_ids to retrieve extended information. [Optional] screen_name: A list of screen_names to retrieve extended information. [Optional] users: A list of twitter.User objects to retrieve extended information. [Optional] Returns: A list of twitter.User objects for the requested users` VerifyCredentials(self) `Returns a twitter.User instance if the authenticating user is valid. Returns: A twitter.User instance representing that user if the credentials are valid, None otherwise.` __init__(self, consumer_key=None, consumer_secret=None, access_token_key=None, access_token_secret=None, input_encoding=None, request_headers=None, cache=<object object at 0x1001da0a0>, shortner=None, base_url=None, use_gzip_compression=False, debugHTTP=False) `Instantiate a new twitter.Api object. Args: consumer_key: Your Twitter user's consumer_key. consumer_secret: Your Twitter user's consumer_secret. access_token_key: The oAuth access token key value you retrieved from running get_access_token.py. access_token_secret: The oAuth access token's secret, also retrieved from the get_access_token.py run. input_encoding: The encoding used to encode input strings. [Optional] request_header: A dictionary of additional HTTP request headers. [Optional] cache: The cache instance to use. Defaults to DEFAULT_CACHE. Use None to disable caching. [Optional] shortner: The shortner instance to use. Defaults to None. See shorten_url.py for an example shortner. [Optional] base_url: The base URL to use to contact the Twitter API. Defaults to https://twitter.com. [Optional] use_gzip_compression: Set to True to tell enable gzip compression for any call made to Twitter. Defaults to False. [Optional] debugHTTP: Set to True to enable debug output from urllib2 when performing any HTTP requests. Defaults to False. [Optional]` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: DEFAULT_CACHE_TIMEOUT = 60
class DirectMessage(__builtin__.object)
`` | `A class representing the DirectMessage structure used by the twitter API. The DirectMessage structure exposes the following properties: direct_message.id direct_message.created_at direct_message.created_at_in_seconds # read only direct_message.sender_id direct_message.sender_screen_name direct_message.recipient_id direct_message.recipient_screen_name direct_message.text`
| Methods defined here: AsDict(self) `A dict representation of this twitter.DirectMessage instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.DirectMessage instance` AsJsonString(self) `A JSON string representation of this twitter.DirectMessage instance. Returns: A JSON string representation of this twitter.DirectMessage instance` GetCreatedAt(self) `Get the time this direct message was posted. Returns: The time this direct message was posted` GetCreatedAtInSeconds(self) `Get the time this direct message was posted, in seconds since the epoch. Returns: The time this direct message was posted, in seconds since the epoch.` GetId(self) `Get the unique id of this direct message. Returns: The unique id of this direct message` GetRecipientId(self) `Get the unique recipient id of this direct message. Returns: The unique recipient id of this direct message` GetRecipientScreenName(self) `Get the unique recipient screen name of this direct message. Returns: The unique recipient screen name of this direct message` GetSenderId(self) `Get the unique sender id of this direct message. Returns: The unique sender id of this direct message` GetSenderScreenName(self) `Get the unique sender screen name of this direct message. Returns: The unique sender screen name of this direct message` GetText(self) `Get the text of this direct message. Returns: The text of this direct message.` SetCreatedAt(self, created_at) `Set the time this direct message was posted. Args: created_at: The time this direct message was created` SetId(self, id) `Set the unique id of this direct message. Args: id: The unique id of this direct message` SetRecipientId(self, recipient_id) `Set the unique recipient id of this direct message. Args: recipient_id: The unique recipient id of this direct message` SetRecipientScreenName(self, recipient_screen_name) `Set the unique recipient screen name of this direct message. Args: recipient_screen_name: The unique recipient screen name of this direct message` SetSenderId(self, sender_id) `Set the unique sender id of this direct message. Args: sender_id: The unique sender id of this direct message` SetSenderScreenName(self, sender_screen_name) `Set the unique sender screen name of this direct message. Args: sender_screen_name: The unique sender screen name of this direct message` SetText(self, text) `Set the text of this direct message. Args: text: The text of this direct message` __eq__(self, other) __init__(self, id=None, created_at=None, sender_id=None, sender_screen_name=None, recipient_id=None, recipient_screen_name=None, text=None) `An object to hold a Twitter direct message. This class is normally instantiated by the twitter.Api class and returned in a sequence. Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" Args: id: The unique id of this direct message. [Optional] created_at: The time this direct message was posted. [Optional] sender_id: The id of the twitter user that sent this message. [Optional] sender_screen_name: The name of the twitter user that sent this message. [Optional] recipient_id: The id of the twitter that received this message. [Optional] recipient_screen_name: The name of the twitter that received this message. [Optional] text: The text of this direct message. [Optional]` __ne__(self, other) __str__(self) `A string representation of this twitter.DirectMessage instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.DirectMessage instance.` Static methods defined here: NewFromJsonDict(data) `Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.DirectMessage instance` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` created_at `The time this direct message was posted.` created_at_in_seconds `The time this direct message was posted, in seconds since the epoch` id `The unique id of this direct message.` recipient_id `The unique recipient id of this direct message.` recipient_screen_name `The unique recipient screen name of this direct message.` sender_id `The unique sender id of this direct message.` sender_screen_name `The unique sender screen name of this direct message.` text `The text of this direct message`
class Hashtag(__builtin__.object)
`` | `A class represeinting a twitter hashtag`
| Methods defined here: __init__(self, text=None) Static methods defined here: NewFromJsonDict(data) `Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Hashtag instance` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class List(__builtin__.object)
`` | `A class representing the List structure used by the twitter API. The List structure exposes the following properties: list.id list.name list.slug list.description list.full_name list.mode list.uri list.member_count list.subscriber_count list.following`
| Methods defined here: AsDict(self) `A dict representation of this twitter.List instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.List instance` AsJsonString(self) `A JSON string representation of this twitter.List instance. Returns: A JSON string representation of this twitter.List instance` GetDescription(self) `Get the description of this list. Returns: The description of this list` GetFollowing(self) `Get the following status of this list. Returns: The following status of this list` GetFull_name(self) `Get the full_name of this list. Returns: The full_name of this list` GetId(self) `Get the unique id of this list. Returns: The unique id of this list` GetMember_count(self) `Get the member_count of this list. Returns: The member_count of this list` GetMode(self) `Get the mode of this list. Returns: The mode of this list` GetName(self) `Get the real name of this list. Returns: The real name of this list` GetSlug(self) `Get the slug of this list. Returns: The slug of this list` GetSubscriber_count(self) `Get the subscriber_count of this list. Returns: The subscriber_count of this list` GetUri(self) `Get the uri of this list. Returns: The uri of this list` GetUser(self) `Get the user of this list. Returns: The owner of this list` SetDescription(self, description) `Set the description of this list. Args: description: The description of this list.` SetFollowing(self, following) `Set the following status of this list. Args: following: The following of this list.` SetFull_name(self, full_name) `Set the full_name of this list. Args: full_name: The full_name of this list.` SetId(self, id) `Set the unique id of this list. Args: id: The unique id of this list.` SetMember_count(self, member_count) `Set the member_count of this list. Args: member_count: The member_count of this list.` SetMode(self, mode) `Set the mode of this list. Args: mode: The mode of this list.` SetName(self, name) `Set the real name of this list. Args: name: The real name of this list` SetSlug(self, slug) `Set the slug of this list. Args: slug: The slug of this list.` SetSubscriber_count(self, subscriber_count) `Set the subscriber_count of this list. Args: subscriber_count: The subscriber_count of this list.` SetUri(self, uri) `Set the uri of this list. Args: uri: The uri of this list.` SetUser(self, user) `Set the user of this list. Args: user: The owner of this list.` __eq__(self, other) __init__(self, id=None, name=None, slug=None, description=None, full_name=None, mode=None, uri=None, member_count=None, subscriber_count=None, following=None, user=None) __ne__(self, other) __str__(self) `A string representation of this twitter.List instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.List instance.` Static methods defined here: NewFromJsonDict(data) `Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.List instance` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` description `The description of this list.` following `The following status of this list.` full_name `The full_name of this list.` id `The unique id of this list.` member_count `The member_count of this list.` mode `The mode of this list.` name `The real name of this list.` slug `The slug of this list.` subscriber_count `The subscriber_count of this list.` uri `The uri of this list.` user `The owner of this list.`
class Status(__builtin__.object)
`` | `A class representing the Status structure used by the twitter API. The Status structure exposes the following properties: status.created_at status.created_at_in_seconds # read only status.favorited status.in_reply_to_screen_name status.in_reply_to_user_id status.in_reply_to_status_id status.truncated status.source status.id status.text status.location status.relative_created_at # read only status.user status.urls status.user_mentions status.hashtags`
| Methods defined here: AsDict(self) `A dict representation of this twitter.Status instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.Status instance` AsJsonString(self) `A JSON string representation of this twitter.Status instance. Returns: A JSON string representation of this twitter.Status instance` GetCreatedAt(self) `Get the time this status message was posted. Returns: The time this status message was posted` GetCreatedAtInSeconds(self) `Get the time this status message was posted, in seconds since the epoch. Returns: The time this status message was posted, in seconds since the epoch.` GetFavorited(self) `Get the favorited setting of this status message. Returns: True if this status message is favorited; False otherwise` GetId(self) `Get the unique id of this status message. Returns: The unique id of this status message` GetInReplyToScreenName(self) GetInReplyToStatusId(self) GetInReplyToUserId(self) GetLocation(self) `Get the geolocation associated with this status message Returns: The geolocation string of this status message.` GetNow(self) `Get the wallclock time for this status message. Used to calculate relative_created_at. Defaults to the time the object was instantiated. Returns: Whatever the status instance believes the current time to be, in seconds since the epoch.` GetRelativeCreatedAt(self) `Get a human redable string representing the posting time Returns: A human readable string representing the posting time` GetSource(self) GetText(self) `Get the text of this status message. Returns: The text of this status message.` GetTruncated(self) GetUser(self) `Get a twitter.User reprenting the entity posting this status message. Returns: A twitter.User reprenting the entity posting this status message` SetCreatedAt(self, created_at) `Set the time this status message was posted. Args: created_at: The time this status message was created` SetFavorited(self, favorited) `Set the favorited state of this status message. Args: favorited: boolean True/False favorited state of this status message` SetId(self, id) `Set the unique id of this status message. Args: id: The unique id of this status message` SetInReplyToScreenName(self, in_reply_to_screen_name) SetInReplyToStatusId(self, in_reply_to_status_id) SetInReplyToUserId(self, in_reply_to_user_id) SetLocation(self, location) `Set the geolocation associated with this status message Args: location: The geolocation string of this status message` SetNow(self, now) `Set the wallclock time for this status message. Used to calculate relative_created_at. Defaults to the time the object was instantiated. Args: now: The wallclock time for this instance.` SetSource(self, source) SetText(self, text) `Set the text of this status message. Args: text: The text of this status message` SetTruncated(self, truncated) SetUser(self, user) `Set a twitter.User reprenting the entity posting this status message. Args: user: A twitter.User reprenting the entity posting this status message` __eq__(self, other) __init__(self, created_at=None, favorited=None, id=None, text=None, location=None, user=None, in_reply_to_screen_name=None, in_reply_to_user_id=None, in_reply_to_status_id=None, truncated=None, source=None, now=None, urls=None, user_mentions=None, hashtags=None) `An object to hold a Twitter status message. This class is normally instantiated by the twitter.Api class and returned in a sequence. Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" Args: created_at: The time this status message was posted. [Optiona] favorited: Whether this is a favorite of the authenticated user. [Optiona] id: The unique id of this status message. [Optiona] text: The text of this status message. [Optiona] location: the geolocation string associated with this message. [Optiona] relative_created_at: A human readable string representing the posting time. [Optiona] user: A twitter.User instance representing the person posting the message. [Optiona] now: The current time, if the client choses to set it. Defaults to the wall clock time. [Optiona]` __ne__(self, other) __str__(self) `A string representation of this twitter.Status instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.Status instance.` Static methods defined here: NewFromJsonDict(data) `Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Status instance` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` created_at `The time this status message was posted.` created_at_in_seconds `The time this status message was posted, in seconds since the epoch` favorited `The favorited state of this status message.` id `The unique id of this status message.` in_reply_to_screen_name `` in_reply_to_status_id `` in_reply_to_user_id `` location `The geolocation string of this status message` now `The wallclock time for this status instance.` relative_created_at `Get a human readable string representing the posting time` source `` text `The text of this status message` truncated `` user `A twitter.User reprenting the entity posting this status message`
class Trend(__builtin__.object)
`` | `A class representing a trending topic`
| Methods defined here: __init__(self, name=None, query=None, timestamp=None) __str__(self) Static methods defined here: NewFromJsonDict(data, timestamp=None) `Create a new instance based on a JSON dict Args: data: A JSON dict timestamp: Gets set as the timestamp property of the new object Returns: A twitter.Trend object` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class TwitterError(exceptions.Exception)
`` | `Base class for Twitter errors`
| Method resolution order: TwitterError exceptions.Exception exceptions.BaseException __builtin__.object Data descriptors defined here: __weakref__ `list of weak references to the object (if defined)` message `Returns the first argument used to construct this error.` Methods inherited from exceptions.Exception: __init__(...) `x.__init__(...) initializes x; see x.__class__.__doc__ for signature` Data and other attributes inherited from exceptions.Exception: __new__ = <built-in method __new__ of type object at 0x100119f80> `T.__new__(S, ...) -> a new object with type S, a subtype of T` Methods inherited from exceptions.BaseException: __delattr__(...) `x.__delattr__('name') <==> del x.name` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __getslice__(...) `x.__getslice__(i, j) <==> x[i:j] Use of negative indices is not supported.` __reduce__(...) __repr__(...) `x.__repr__() <==> repr(x)` __setattr__(...) `x.__setattr__('name', value) <==> x.name = value` __setstate__(...) __str__(...) `x.__str__() <==> str(x)` __unicode__(...) Data descriptors inherited from exceptions.BaseException: __dict__ args
class Url(__builtin__.object)
`` | `A class representing an URL contained in a tweet`
| Methods defined here: __init__(self, url=None, expanded_url=None) Static methods defined here: NewFromJsonDict(data) `Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Url instance` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class User(__builtin__.object)
`` | `A class representing the User structure used by the twitter API. The User structure exposes the following properties: user.id user.name user.screen_name user.location user.description user.profile_image_url user.profile_background_tile user.profile_background_image_url user.profile_sidebar_fill_color user.profile_background_color user.profile_link_color user.profile_text_color user.protected user.utc_offset user.time_zone user.url user.status user.statuses_count user.followers_count user.friends_count user.favourites_count`
| Methods defined here: AsDict(self) `A dict representation of this twitter.User instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.User instance` AsJsonString(self) `A JSON string representation of this twitter.User instance. Returns: A JSON string representation of this twitter.User instance` GetDescription(self) `Get the short text description of this user. Returns: The short text description of this user` GetFavouritesCount(self) `Get the number of favourites for this user. Returns: The number of favourites for this user.` GetFollowersCount(self) `Get the follower count for this user. Returns: The number of users following this user.` GetFriendsCount(self) `Get the friend count for this user. Returns: The number of users this user has befriended.` GetId(self) `Get the unique id of this user. Returns: The unique id of this user` GetLocation(self) `Get the geographic location of this user. Returns: The geographic location of this user` GetName(self) `Get the real name of this user. Returns: The real name of this user` GetProfileBackgroundColor(self) GetProfileBackgroundImageUrl(self) GetProfileBackgroundTile(self) `Boolean for whether to tile the profile background image. Returns: True if the background is to be tiled, False if not, None if unset.` GetProfileImageUrl(self) `Get the url of the thumbnail of this user. Returns: The url of the thumbnail of this user` GetProfileLinkColor(self) GetProfileSidebarFillColor(self) GetProfileTextColor(self) GetProtected(self) GetScreenName(self) `Get the short twitter name of this user. Returns: The short twitter name of this user` GetStatus(self) `Get the latest twitter.Status of this user. Returns: The latest twitter.Status of this user` GetStatusesCount(self) `Get the number of status updates for this user. Returns: The number of status updates for this user.` GetTimeZone(self) `Returns the current time zone string for the user. Returns: The descriptive time zone string for the user.` GetUrl(self) `Get the homepage url of this user. Returns: The homepage url of this user` GetUtcOffset(self) SetDescription(self, description) `Set the short text description of this user. Args: description: The short text description of this user` SetFavouritesCount(self, count) `Set the favourite count for this user. Args: count: The number of favourites for this user.` SetFollowersCount(self, count) `Set the follower count for this user. Args: count: The number of users following this user.` SetFriendsCount(self, count) `Set the friend count for this user. Args: count: The number of users this user has befriended.` SetId(self, id) `Set the unique id of this user. Args: id: The unique id of this user.` SetLocation(self, location) `Set the geographic location of this user. Args: location: The geographic location of this user` SetName(self, name) `Set the real name of this user. Args: name: The real name of this user` SetProfileBackgroundColor(self, profile_background_color) SetProfileBackgroundImageUrl(self, profile_background_image_url) SetProfileBackgroundTile(self, profile_background_tile) `Set the boolean flag for whether to tile the profile background image. Args: profile_background_tile: Boolean flag for whether to tile or not.` SetProfileImageUrl(self, profile_image_url) `Set the url of the thumbnail of this user. Args: profile_image_url: The url of the thumbnail of this user` SetProfileLinkColor(self, profile_link_color) SetProfileSidebarFillColor(self, profile_sidebar_fill_color) SetProfileTextColor(self, profile_text_color) SetProtected(self, protected) SetScreenName(self, screen_name) `Set the short twitter name of this user. Args: screen_name: the short twitter name of this user` SetStatus(self, status) `Set the latest twitter.Status of this user. Args: status: The latest twitter.Status of this user` SetStatusesCount(self, count) `Set the status update count for this user. Args: count: The number of updates for this user.` SetTimeZone(self, time_zone) `Sets the user's time zone string. Args: time_zone: The descriptive time zone to assign for the user.` SetUrl(self, url) `Set the homepage url of this user. Args: url: The homepage url of this user` SetUtcOffset(self, utc_offset) __eq__(self, other) __init__(self, id=None, name=None, screen_name=None, location=None, description=None, profile_image_url=None, profile_background_tile=None, profile_background_image_url=None, profile_sidebar_fill_color=None, profile_background_color=None, profile_link_color=None, profile_text_color=None, protected=None, utc_offset=None, time_zone=None, followers_count=None, friends_count=None, statuses_count=None, favourites_count=None, url=None, status=None) __ne__(self, other) __str__(self) `A string representation of this twitter.User instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.User instance.` Static methods defined here: NewFromJsonDict(data) `Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.User instance` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` description `The short text description of this user.` favourites_count `The number of favourites for this user.` followers_count `The number of users following this user.` friends_count `The number of friends for this user.` id `The unique id of this user.` location `The geographic location of this user.` name `The real name of this user.` profile_background_color profile_background_image_url `The url of the profile background of this user.` profile_background_tile `Boolean for whether to tile the background image.` profile_image_url `The url of the thumbnail of this user.` profile_link_color profile_sidebar_fill_color profile_text_color protected screen_name `The short twitter name of this user.` status `The latest twitter.Status of this user.` statuses_count `The number of updates for this user.` time_zone `Returns the current time zone string for the user. Returns: The descriptive time zone string for the user.` url `The homepage url of this user.` utc_offset

Functions
`` |  | md5 = openssl_md5(...) `Returns a md5 hash object; optionally initialized with a string`

Data
`` |  | ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' CHARACTER_LIMIT = 140 DEFAULT_CACHE = <object object at 0x1001da0a0> REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' __author__ = 'python-twitter@googlegroups.com' __version__ = '0.8'

Author
`` |  | python-twitter@googlegroups.com