You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using twitter-lite to periodically check the "followers" of 4 Twitter accounts. I know there's a rate limit for this operation, and since I'm creating a bot that people can trigger I want to make sure I don't hit the rate limit.
So just looking for a way to find out the number of requests I have left in each time-window. Is there a way to calculate this with twitter-lite or does Twitter API even report this number?
I'm open to any other ways or suggestions to tackle this.
The text was updated successfully, but these errors were encountered:
@0xtetus don't know if you ever found out, but it looks like the post method returns _header that will contain the response headers:
/**
* Send a POST request
* @param {string} resource - endpoint, e.g. `users/lookup`
* @param {object} body - POST parameters object.
* Will be encoded appropriately (JSON or urlencoded) based on the resource
* @returns {Promise<object>} Promise resolving to the response from the Twitter API.
* The `_header` property will be set to the Response headers (useful for checking rate limits)
*/
post(resource, body)
...
There's an x-rate-limit-remaining header returned that should have what you're looking for.
I'm using
twitter-lite
to periodically check the "followers" of 4 Twitter accounts. I know there's a rate limit for this operation, and since I'm creating a bot that people can trigger I want to make sure I don't hit the rate limit.So just looking for a way to find out the number of requests I have left in each time-window. Is there a way to calculate this with
twitter-lite
or does Twitter API even report this number?I'm open to any other ways or suggestions to tackle this.
The text was updated successfully, but these errors were encountered: