Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PierreRochard/c8444b41307a413ad5c552501ba5198e to your computer and use it in GitHub Desktop.
Save PierreRochard/c8444b41307a413ad5c552501ba5198e to your computer and use it in GitHub Desktop.
Twython auth flow
from twython import Twython
api_key = input('Enter the API key: ')
print('\n')
api_secret = input('Enter the API secret: ')
print('\n')
twitter = Twython(api_key, api_secret)
auth = twitter.get_authentication_tokens()
print(auth['auth_url'])
oauth_verifier = input('Enter your pin: ')
print('\n')
twitter = Twython(api_key,
api_secret,
auth['oauth_token'],
auth['oauth_token_secret'])
final_step = twitter.get_authorized_tokens(oauth_verifier)
print(f"BITCOIN_CONFIRMS_TWITTER_APP_KEY={auth['oauth_token']}")
print(f"BITCOIN_CONFIRMS_TWITTER_APP_SECRET={auth['oauth_token_secret']}")
print(f"BITCOIN_CONFIRMS_TWITTER_OAUTH_TOKEN={final_step['oauth_token']}")
print(f"BITCOIN_CONFIRMS_TWITTER_OAUTH_TOKEN_SECRET={final_step['oauth_token_secret']}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment