Forums

tweepy.error.TweepError: Not authorized.

Hello, I have a webapp that uses tweepy to gather and analyze tweets from Twitter. The app works fine on my local computer, but when I try to run it on PythonAnywere I get the following error:

tweepy.error.TweepError: Not authorized.

Here are the basics of the code:

consumer_key = 'my_private_consumer_key'
consumer_secret = 'my_private_consumer_secret'
access_token = 'my_private_access_token'
access_token_secret = 'my_private_access_token_secret'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth,wait_on_rate_limit=True)
tweets = api.user_timeline(accountName, page=1, tweet_mode="extended")

As I said, it works fine when run from my computer, so I know my tokens and keys are ok. Is there an extra authorization required for a web app on the PythonAnywhere server, or am I missing something else?

Thank you!

We do not modify the requests that you make in any way. If you are getting an authentication error from Twitter, it is because there is something wrong with your authentication. Check the content of the error that you are getting. Perhaps there is an indication in there to help you to work out what is wrong.

Thank you. Resolved.

Glad to hear that!