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:"
|
print "Then paste the Personal Identification Number given by Twitter:"
|
||||||
verifier = raw_input('PIN: ').strip()
|
verifier = raw_input('PIN: ').strip()
|
||||||
auth.get_access_token(verifier)
|
token = auth.get_access_token(verifier)
|
||||||
# print 'ACCESS_KEY = "%s"' % auth.access_token.key
|
|
||||||
# print 'ACCESS_SECRET = "%s"' % auth.access_token.secret
|
|
||||||
|
|
||||||
# Authenticate and get the user name.
|
# 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)
|
api = tweepy.API(auth)
|
||||||
username = api.me().name
|
username = api.me().name
|
||||||
print "Authentication successful, ready to post to account: " + username
|
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"):
|
if not config.has_section("Auth"):
|
||||||
config.add_section('Auth')
|
config.add_section('Auth')
|
||||||
config.set('Auth', 'local_token', auth.access_token.key)
|
config.set('Auth', 'local_token', token_key)
|
||||||
config.set('Auth', 'local_token_secret', auth.access_token.secret)
|
config.set('Auth', 'local_token_secret', token_secret)
|
||||||
|
|
||||||
# Writing our configuration file to 'example.cfg'
|
# Writing our configuration file to 'example.cfg'
|
||||||
with open(configfile, 'wb') as fd:
|
with open(configfile, 'wb') as fd:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue