Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check x-rate-limit-* response headers #1

Open
milh0use opened this issue Apr 27, 2018 · 0 comments
Open

Check x-rate-limit-* response headers #1

milh0use opened this issue Apr 27, 2018 · 0 comments

Comments

@milh0use
Copy link
Owner

Check the response headers for guidance on request rates

x-rate-limit-limit: The number of times you can request the given endpoint within a certain number of minutes (otherwise known as a window).
x-rate-limit-remaining: The number of times you have left for a given endpoint within a window.
x-rate-limit-reset: The number of seconds left until the window resets.
For most endpoints, this is 15 requests per 15 minutes. So if you have set the global sleep_on_rate_limit to True, the process looks something like this:
api.GetListMembersPaged()
# GET /list/{id}/members.json?cursor=-1
# GET /list/{id}/members.json?cursor=2
# GET /list/{id}/members.json?cursor=3
# GET /list/{id}/members.json?cursor=4
# GET /list/{id}/members.json?cursor=5
# GET /list/{id}/members.json?cursor=6
# GET /list/{id}/members.json?cursor=7
# GET /list/{id}/members.json?cursor=8
# GET /list/{id}/members.json?cursor=9
# GET /list/{id}/members.json?cursor=10
# GET /list/{id}/members.json?cursor=11
# GET /list/{id}/members.json?cursor=12
# GET /list/{id}/members.json?cursor=13
# GET /list/{id}/members.json?cursor=14

# This last GET request returns a response where x-rate-limit-remaining
# is equal to 0, so the API sleeps for 15 minutes

# GET /list/{id}/members.json?cursor=15

# ... etc ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant