Skip to content

Instantly share code, notes, and snippets.

@michaelhelmick
Created June 13, 2013 20:16
Show Gist options
  • Save michaelhelmick/5776974 to your computer and use it in GitHub Desktop.
Save michaelhelmick/5776974 to your computer and use it in GitHub Desktop.
from twython import Twython

Obtain an OAuth 2 Access Token

APP_KEY = 'YOUR_APP_KEY'
APP_SECET = 'YOUR_APP_SECRET'

twitter = Twython(APP_KEY, APP_SECRET, oauth_version=2)
ACCESS_TOKEN = twitter.obtain_access_token()

Save ACCESS_TOKEN in a database or something for later use!

Use the Access Token

APP_KEY = 'YOUR_APP_KEY'
ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN'

twitter = Twython(APP_KEY, access_token=ACCESS_TOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment