I am currently doing my first steps towards using the Twitter API, I am using Anacoda and Twython. However, I am always getting the following error message:
twython.exceptions.TwythonAuthError: Twitter API returned a 401 (Unauthorized), Invalid or expired token.t
This is the code I am using:
from twython import Twython, TwythonError # Requires Authentication as of Twitter API v1.1 twitter = Twython('XYZ', 'XYZ', 'XYZ', 'XYZ') try: search_results = twitter.search(q='WebsDotCom', count=50) except TwythonError as e: print e for tweet in search_results['statuses']: print 'Tweet from @%s Date: %s' % (tweet['user']['screen_nam\ e'].encode('utf-8'), tweet['created_at']) print tweet['text'].encode('utf-8'), '\n'from twython import Twython, TwythonError
Does anybody whats wrong with the code? Of course, I am not using thr XYZ as the authentification tokens.