· 7 years ago · Feb 17, 2018, 11:10 PM
1from birdy.twitter import UserClient
2
3CONSUMER_KEY = 'getthisfromappstwittercom'
4CONSUMER_SECRET = 'getthisfromappstwittercom'
5
6client = UserClient(CONSUMER_KEY, CONSUMER_SECRET)
7
8token = client.get_authorize_token()
9
10ACCESS_TOKEN = token.oauth_token
11ACCESS_TOKEN_SECRET = token.oauth_token_secret
12
13print "Go to the following URL to get your PIN: "
14print token.auth_url
15
16# Get PIN (OAUTH_VERIFIER) from user
17OAUTH_VERIFIER = raw_input("Enter PIN: ")
18
19client = UserClient(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
20
21token = client.get_access_token(OAUTH_VERIFIER)
22
23# Display OAUTH token and secret
24print "Save these values in your application: "
25print "OAUTH_TOKEN = '" + token.oauth_token + "'"
26print "OAUTH_TOKEN_SECRET = '" + token.oauth_token_secret + "'"