fix: use the new tweepy api about access tokens
This commit is contained in:
parent
c3ed359cf2
commit
6da199beb1
1 changed files with 5 additions and 6 deletions
11
forthlift.py
11
forthlift.py
|
|
@ -168,12 +168,11 @@ def setup_twitter(configfile="twitter.conf"):
|
|||
|
||||
print "Then paste the Personal Identification Number given by Twitter:"
|
||||
verifier = raw_input('PIN: ').strip()
|
||||
auth.get_access_token(verifier)
|
||||
# print 'ACCESS_KEY = "%s"' % auth.access_token.key
|
||||
# print 'ACCESS_SECRET = "%s"' % auth.access_token.secret
|
||||
token = auth.get_access_token(verifier)
|
||||
|
||||
# Authenticate and get the user name.
|
||||
auth.set_access_token(auth.access_token.key, auth.access_token.secret)
|
||||
token_key, token_secret = token
|
||||
auth.set_access_token(token_key, token_secret)
|
||||
api = tweepy.API(auth)
|
||||
username = api.me().name
|
||||
print "Authentication successful, ready to post to account: " + username
|
||||
|
|
@ -187,8 +186,8 @@ def setup_twitter(configfile="twitter.conf"):
|
|||
|
||||
if not config.has_section("Auth"):
|
||||
config.add_section('Auth')
|
||||
config.set('Auth', 'local_token', auth.access_token.key)
|
||||
config.set('Auth', 'local_token_secret', auth.access_token.secret)
|
||||
config.set('Auth', 'local_token', token_key)
|
||||
config.set('Auth', 'local_token_secret', token_secret)
|
||||
|
||||
# Writing our configuration file to 'example.cfg'
|
||||
with open(configfile, 'wb') as fd:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue