Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upPeriodic http 401 errors from Twitter #582
Comments
This comment has been minimized.
This comment has been minimized.
|
Just food for thought, could it be because I am being login rate limited when doing the retweet? I am doing the login stuff in the retweet function, so perhaps I am being rate limited if I get a few retweets in a short window? Could I just authenticate once in the "f name == 'main':" section of my code? |
This comment has been minimized.
This comment has been minimized.
|
Moving the |
This comment has been minimized.
This comment has been minimized.
|
Tweepy exceptions have a
Twitter usually tells you if you're being rate limited. I also noticed that you're not setting the access token in |
This comment has been minimized.
This comment has been minimized.
|
I'll put the exception bit into my code to see if it gives more info instead of just the 401. I added some retry bits into the auth, so if it error out again I will add the exception print. I was under the impression that I only needed one access token and it didn't time out, I have the auth.set_access_token() running before we hop into the streaming section. |
This comment has been minimized.
This comment has been minimized.
|
No luck with the try/except section. "on_exception" in streaming.py is catching the exception before I can print out the response. At a minimum I am getting the 401 status code. |
tehspaceg commentedMar 27, 2015
I am receiving HTTP 401 errors while running through a script I created that reads the Twitter stream and retweets things that match the parameters I have set. It occasionally fails during the retweet section with:
I confirmed that the time is valid on the system and within the ~15 minute wiggle room. The code works the majority of the time, so I am not sure why it would throw the 401 status. Maybe a side question, but is there a more verbose error I can print? I know Twitter will return more information on why it threw 401 (such as unauthorized)
I snipped out some non-interesting parts, but here is the main part of the code: