Twython updateStatus - Unauthorized: Invalid / Expired Token

I am trying to tweet using Twython from a site running on Django. However, the string 'twitter.updateStatus (status = tweet_text) leads to the following error:

TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. -- Invalid / expired Token' 

I have queries version 0.13.9, so this should not be a problem:

 >>>import pkg_resources >>>pkg_resources.get_distribution("requests").version '0.13.9' >>>pkg_resources.get_distribution("twython").version '2.3.4' 

Any idea how to fix this? Thanks in advance!

Here's the python method itself:

 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('') 
+4
source share
1 answer

I am the author of Twython.

This error occurred due to a problem with the dependencies that we have (Requests) that were fixed with v0.13.9 queries. It should be fine now; Feel free to contact me if not.

+2
source

All Articles