Rate limiting is much harsher than the docs suggest


I am writing a short script to unlike (unfavorite [sic]) everything created by a user.

However, I’m hitting rate limits much much sooner than expected. I’m able to unlike 5 messages every 15 minutes and I was expecting more like 180 / 15 minutes. Anybody know what’s going on?

My script is a super simple python / tweepy thing that just uses the obvious endpoints

def purge():
    tweets = api.favorites(user)
    for f in tweets:
          print("SUCCESS {}".format(f.text))
        except tweepy.error.TweepError:
          print("FAILURE {} {}".format(f.text, f.id))


(I created a separate ticket to discuss the create/destroy hack over at Many tweets in a zombie favorite, but not favorite, state? )


The documented 180 / 15 rate limit is for GET requests. Since you are performing a POST/DELETE request, it falls under the Twitter account rate limits which Twitter mostly doesn’t publish. See GET and POST Request Limits.


Alot of the “unpublished” rate limits are included in the response headers fwiw.


The comment above was marked as the solution, but in fact it is not the solution, despite sounding plausible.

In fact, what is happening is that because of Many tweets in a zombie favorite, but not favorite, state? (which appears to be bug on the twitter server side) my request to api.favorites(user) is returning instantly with an empty list, and the main loop is therefore running purge in tight succession, resulting in hitting the actual (genuine) rate limits of approximately 180 req / 15 minutes.

A break condition of

    if len(tweets) == 0:
        print("no favorites left")

avoids hitting the limit but unfortunately the twitter bug is stopping me from being able to write this script.


Apologies. I marked the previous post as a solution as it addressed the question around rate limiting I.e that this is an account limit. I’m aware you’ve asked another question related to what you describe as “zombie” elements. That’s not the same as the rate or account limiting question.