I’ve been having 404 errors from the Tweepy OAuth handler for a long time (probably rate-limited on an app basis, but who knows), so I added retries to the OAuth handler itself, and the errors seem to have been silenced at least for a few weeks.
My code changed from:
api = tweepy.API(auth, wait_on_rate_limit = True, wait_on_rate_limit_notify = True, compression = True)
to:
api = tweepy.API(auth, retry_count = 5, retry_delay = 5, retry_errors = set([401, 404, 500, 503]), wait_on_rate_limit = True, wait_on_rate_limit_notify = True, compression = True)
That doesn’t mean the errors went away – they’re just silenced for now and retried until they succeed.
I still get a lot of Resetting dropped connection: api.twitter.com errors in my Tweepy logs each time the OAuth handler encounters a 404.
My questions are:
-
Does Twitter not support Keep-Alive?
-
Is it because I’m make too many repeated authentications within a certain window, so they cut me off as a protective/defensive measure against abuse or DDoS? How can I prevent the 404 errors in the first place?
And today even the retries all failed, so obviously something somewhere has changed.
What gives?
1 Like
Sorry for bumping this so soon, we’re still having our connections to api.twitter.com dropped randomly for no reason, returning 404 errors, no matter how many retries.
It’s very urgent, so if anyone has any idea how to fix this, it’s deeply appreciated.
@antsstyle, I believe you brought up this concern before, regarding rate limits for oauth endpoints (which aren’t explicitly stated in the docs). Did you find out anything about it? I think we’re experiencing precisely what you worried might one day happen – i.e. GET oauth endpoints being rate-limited.
1 Like
Okay, this is getting weird.
My connections to api.twitter.com keep getting dropped when I make it from my Celery task process, but when I manually post a tweet from the Python shell… It worked!
What gives?
1 Like
Problem was resolved once I upgraded to Tweepy 3.10.0 from Tweepy 3.8.0.
So freaking weird.
Sorry, mods can close this.
4 Likes