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('')
source share