Hello,
In my research application I need to download information about a bunch of profiles using lookup.json and show.json API endpoints. I access the API using ‘twitter’ python library.
Before each round of calls to the API I check with CheckRateLimit if the call limit has been reached, and then use CheckRateLimit again to find out when the limit will renew.
To save time I run a round of calls to show.json during the time when lookup.json is idling waiting for the limits to renew.
This method worked fine until several months ago.
Currently only the first round of interleaved calls is successful. Limits for lookup.json reset as expected, but checking for limits for show.json always returns 0 available calls, and reset time in the past (when the first failed reset should have occurred).
Situation gets back to normal when I stop using lookup.json, and issue only calls to show.json (without restarting the application).
After restarting the application I get one successful round of calls to both endpoints, and no resets on show.json on the following rounds.
Here is an example of what the result from CheckRateLimit looks like:
EndpointRateLimit(limit=900, remaining=0, reset=1596424873)
this translates to:
Remaining calls: 0, Limit will reset in -22:00:50 (2020-08-02 23:21:13)
I tried using separate API instances for both endpoints (with the same set of OAuth credentials), but it did not solve the issue.
Moving this to the Academic Research category. Also worth being aware that the two endpoints you are currently using are deprecated and replaced by the Twitter Developer Labs (to be API v2) endpoints.
Do you have a more complete code example? CheckRateLimit sounds like it’s a library implementation of checking rate limits. The twitter API returns rate limit info for every request in http headers - so those are usually better to use. These limits are separate per endpoint, so they should not affect each other, unless some python code is mixing things up.
1 Like
system
Closed
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.