You need to authenticate the user
twitter = Twython(APP_KEY, APP_SECRET)
auth = twitter.get_authentication_tokens(callback_url='http://mysite.com/callback')
Store the oauth tokens from the auth variable and store them somewhere you can retrieve them from when the user returns;
OAUTH_TOKEN = auth['oauth_token']
OAUTH_TOKEN_SECRET = auth['oauth_token_secret']
How you store it depends on your framework
redirect the user to auth url auth['auth_url']
and in the callback, you can retrieve the oauth sessions
Retrieve the oauth_verifier
from the url params
Store the new tokens iin the sessionm, or wherever
twitter = Twython(APP_KEY, APP_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter_authroized=twitter.get_authorized_tokens(oauth_verifier)
OAUTH_TOKEN = twitter_authroized['oauth_token']
OAUTH_TOKEN_SECERT = twitter_authroized['oauth_token_secret']
Use these new OAUTH tokens from now on to make calls to twitter (instead of the old ones)
Read https://twython.readthedocs.org/en/latest/usage/starting_out.html#authentication for this information
https://github.com/ryanmcgrath/twython-django is django project for twitter. Use it for guidance