Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias TryExcept body Import alias identifier ImportFrom alias handlers ExceptHandler type NameLoad body Import alias identifier ImportFrom alias Import alias Import alias Import alias ImportFrom alias alias FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Str Expr Call NameLoad NameLoad keyword NameLoad Expr Call NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return TupleLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr Call AttributeLoad Call AttributeLoad NameLoad attr attr decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If BoolOpOr CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad body Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index Str AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Str AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str Call NameLoad Call NameLoad Call NameLoad Assign SubscriptStore NameLoad Index Str Call NameLoad Call NameLoad Num Assign NameStore Call NameLoad Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore BinOpAdd BinOpAdd AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad Str attr GeneratorExp Call AttributeLoad NameLoad attr NameLoad keyword Str comprehension NameStore ListLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr attr Return BinOpAdd BinOpAdd BinOpAdd NameLoad Str Str Call AttributeLoad NameLoad attr NameLoad keyword Str decorator_list FunctionDef arguments args NameParam defaults body Return Dict decorator_list decorator_list FunctionDef arguments args NameParam defaults body If UnaryOpNot NameLoad body Assign NameStore ListLoad Assign NameStore Str For TupleStore NameStore NameStore NameLoad body If CompareIs Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr Str NameLoad If CompareIs Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore NameLoad Return Call AttributeLoad Call AttributeLoad Call NameLoad NameLoad attr NameLoad Str attr Str Str Return Call AttributeLoad Call NameLoad NameLoad keyword Str attr Str Str decorator_list
N/A N/A 
Visit the Twitter developer page and create a new application:

    https://dev.twitter.com/apps/new

This will get you a CONSUMER_KEY and CONSUMER_SECRET.

When users run your application they have to authenticate your app
with their Twitter account. A few HTTP calls to twitter are required
to do this. Please see the twitter.oauth_dance module to see how this
is done. If you are making a command-line app, you can use the
oauth_dance() function directly.

Performing the "oauth dance" gets you an ouath token and oauth secret
that authenticate the user with Twitter. You should save these for
later so that the user doesn't have to do the oauth dance again.

read_token_file and write_token_file are utility methods to read and
write OAuth token and secret key values. The values are stored as
strings in the file. Not terribly exciting.

Finally, you can use the OAuth authenticator to connect to Twitter. In
code it all goes like this::

    from twitter import *

    MY_TWITTER_CREDS = os.path.expanduser('~/.my_app_credentials')
    if not os.path.exists(MY_TWITTER_CREDS):
        oauth_dance("My App Name", CONSUMER_KEY, CONSUMER_SECRET,
                    MY_TWITTER_CREDS)

    oauth_token, oauth_secret = read_token_file(MY_TWITTER_CREDS)

    twitter = Twitter(auth=OAuth(
        oauth_token, oauth_token_secret, CONSUMER_KEY, CONSUMER_SECRET))

    # Now work with Twitter
    twitter.statuses.update(status='Hello, world!')

 __future__ print_function random getrandbits time time util PY_3_OR_HIGHER N/A N/A N/A urllib.parse urllib_parse urllib.parse urlencode N/A N/A N/A ImportError N/A N/A urllib2 urllib_parse urllib urlencode N/A hashlib N/A hmac N/A base64 auth Auth MissingCredentialsError write_token_file N/A N/A filename oauth_token oauth_token_secret N/A N/A N/A 
    Write a token file to hold the oauth token and oauth token secret.
     N/A oauth_file N/A open filename w N/A N/A print oauth_token file oauth_file N/A N/A print oauth_token_secret file oauth_file N/A N/A N/A oauth_file close N/A read_token_file N/A N/A filename N/A N/A N/A 
    Read a token file and return the oauth token and oauth token secret.
     N/A f N/A open filename N/A N/A N/A N/A N/A N/A f readline strip N/A N/A N/A N/A f readline strip N/A OAuth N/A Auth N/A N/A 
    An OAuth authenticator.
     __init__ N/A N/A self token token_secret consumer_key consumer_secret N/A N/A N/A 
        Create the authenticator. If you are in the initial stages of
        the OAuth dance and don't yet have a token or token_secret,
        pass empty strings for these params.
         N/A N/A self token token N/A N/A self token_secret token_secret N/A N/A self consumer_key consumer_key N/A N/A self consumer_secret consumer_secret N/A N/A N/A token_secret None N/A consumer_secret None N/A N/A N/A MissingCredentialsError You must supply strings for token_secret and consumer_secret, not None. N/A encode_params N/A N/A self base_url method params N/A N/A N/A params N/A N/A params copy N/A N/A self token N/A N/A N/A params N/A oauth_token N/A self token N/A N/A params N/A oauth_consumer_key N/A self consumer_key N/A N/A params N/A oauth_signature_method HMAC-SHA1 N/A N/A params N/A oauth_version 1.0 N/A N/A params N/A oauth_timestamp N/A str N/A int N/A time N/A N/A params N/A oauth_nonce N/A str N/A getrandbits 64 N/A enc_params N/A urlencode_noplus N/A sorted N/A N/A params items N/A key N/A N/A N/A self consumer_secret & N/A N/A urllib_parse quote N/A self token_secret safe ~ N/A message N/A N/A & join N/A N/A N/A urllib_parse quote i safe ~ N/A i N/A N/A N/A method upper base_url enc_params N/A signature N/A N/A base64 b64encode N/A N/A N/A N/A hmac new N/A N/A key encode ascii N/A N/A message encode ascii N/A hashlib sha1 digest N/A N/A N/A N/A enc_params & oauth_signature= N/A N/A urllib_parse quote signature safe ~ N/A generate_headers N/A N/A self N/A N/A N/A N/A N/A N/A urlencode_noplus N/A N/A query N/A N/A N/A N/A PY_3_OR_HIGHER N/A N/A new_query N/A N/A TILDE ____TILDE-PYTHON-TWITTER____ N/A N/A k v query N/A N/A N/A N/A type k unicode N/A N/A k N/A N/A k encode utf-8 N/A k N/A N/A N/A str k replace ~ TILDE N/A N/A N/A type v unicode N/A N/A v N/A N/A v encode utf-8 N/A v N/A N/A N/A str v replace ~ TILDE N/A N/A N/A new_query append N/A k v N/A query new_query N/A N/A N/A N/A N/A N/A urlencode query replace TILDE ~ replace + %20 N/A N/A N/A N/A urlencode query safe ~ replace + %20 N/A