【发布时间】:2013-05-17 04:47:07
【问题描述】:
我的代码如下
import tweepy
CONSUMER_KEY = 'my_consumer_key'
CONSUMER_SECRET = 'my_consumer_secret'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth_url = auth.get_authorization_url()
print 'Please authorize: ' + auth_url
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
当我在终端中运行此脚本时,我收到以下错误:
Traceback (most recent call last):
File "Twitter_OAuth.py", line 8, in <module>
auth_url = auth.get_authorization_url()
File "/usr/lib/python2.7/dist-packages/tweepy/auth.py", line 103, in get_authorization_url
raise TweepError(e)
tweepy.error.TweepError: HTTP Error 401: Unauthorized
我在网上搜索了一下,我认为这与服务器时间有关。但我似乎无法解决它。
我正在开发 Ubuntu 12.10
救命!
【问题讨论】:
标签: python ubuntu twitter oauth