4
我試圖從Django支持的網站發佈使用Twython的推文。然而, 'twitter.updateStatus(狀態= tweet_text)' 行導致以下錯誤:Twython updateStatus - 未經授權:無效/已過期令牌
TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. -- Invalid/expired Token'
我有請求版本0.13.9,所以這不應該是一個問題:
>>>import pkg_resources
>>>pkg_resources.get_distribution("requests").version
'0.13.9'
>>>pkg_resources.get_distribution("twython").version
'2.3.4'
任何想法如何解決這個問題?提前致謝!
這裏的蟒蛇方法本身:
def tweet_link(request, tweet_text):
try:
c = RequestContext(request)
twitter = Twython(
twitter_token = TWITTER_KEY,
twitter_secret = TWITTER_SECRET,
oauth_token = request.session['request_token']['oauth_token'],
oauth_token_secret = request.session['request_token']['oauth_token_secret']
)
twitter.updateStatus(status=tweet_text)
except Exception, e:
print traceback.print_exc()
return HttpResponse('')
嗨瑞安,謝謝你的回覆。我剛剛recyoned twython,重新啓動apache,但仍然得到相同的錯誤 - TwythonError:u'Unauthorized:身份驗證憑據丟失或不正確。 - 無效/過期的令牌'。我錯過了什麼嗎?提前致謝! – Arman
而且我有請求v0.13.9(python2.7/site-packages/requests-0.13.9-py2.7.egg),只是檢查。 – Arman