我正在使用Tweepy library在我的網站上實施「使用Twitter登錄」。Tweepy OAuth - HTTP錯誤404:未找到
正如Tweepy examples所示,我做:
def get(self):
callback_url = "http://127.0.1.1:8080/social_login/complete/"
auth = tweepy.OAuthHandler(
config.twitter_consumer_key,
config.twitter_consumer_secret,
callback_url
)
try:
redirect_url = auth.get_authorization_url()
except tweepy.TweepError, e:
self.redirect_to('error', {'message': e})
request_token = models.OAuthToken(
token_key = auth.request_token.key,
token_secret = auth.request_token.secret
)
request_token.put()
當我運行這段代碼,我得到這個錯誤:
File "/home/jeremy/Dropbox/Projects/bibliogram/controllers/handlers.py", line 72, in get token_key = auth.request_token.key, AttributeError: 'NoneType' object has no attribute 'key'
的tweepy.TweepError,E是:HTTP錯誤404:未找到
我試着用消費者密鑰和祕密從兩個不同租金帳戶。我真的不明白爲什麼它不工作...
有沒有人有任何想法?謝謝
看看這個要點:https://gist.github.com/3737378 –