Created
February 5, 2018 01:24
-
-
Save cherdt/06f558f8f5edbe986deb13bd3cb013ca to your computer and use it in GitHub Desktop.
get a twitter oauth token using the python birdy library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from birdy.twitter import UserClient | |
CONSUMER_KEY = 'getthisfromappstwittercom' | |
CONSUMER_SECRET = 'getthisfromappstwittercom' | |
client = UserClient(CONSUMER_KEY, CONSUMER_SECRET) | |
token = client.get_authorize_token() | |
ACCESS_TOKEN = token.oauth_token | |
ACCESS_TOKEN_SECRET = token.oauth_token_secret | |
print "Go to the following URL to get your PIN: " | |
print token.auth_url | |
# Get PIN (OAUTH_VERIFIER) from user | |
OAUTH_VERIFIER = raw_input("Enter PIN: ") | |
client = UserClient(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) | |
token = client.get_access_token(OAUTH_VERIFIER) | |
# Display OAUTH token and secret | |
print "Save these values in your application: " | |
print "OAUTH_TOKEN = '" + token.oauth_token + "'" | |
print "OAUTH_TOKEN_SECRET = '" + token.oauth_token_secret + "'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment