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

Add Support to access Throttle Headers #112

Open
markalanevans opened this issue Apr 13, 2018 · 3 comments
Open

Add Support to access Throttle Headers #112

markalanevans opened this issue Apr 13, 2018 · 3 comments

Comments

@markalanevans
Copy link

@travega @khalilovcmd so how do i get access to the headers?

X-RateLimit-Limit: Maximum number of operations allowed in the current window
X-RateLimit-Remaining: Number of operations left in the current window.
X-RateLimit-Reset: Time when rate limit window will be reset as a Unix timestamp.
@kmossco
Copy link
Contributor

kmossco commented Apr 26, 2018

@markalanevans at the moment we don't have a way to access these directly, and is one of the reasons why we need to rework that side of the library. This is something we will be addressing soon, but if you have the time and bandwidth I'll be happy to review a PR on this. 👍

@jpasichnyk
Copy link
Contributor

+1 I was thinking these should be bubbled up in a custom exception indicating to the caller that they were "rate limited", as easy to access properties. Or at minimum as some dictionary entries like other errors are returned.

@lloydliyu lloydliyu changed the title How do we Access Throttle Headers Add Support to access Throttle Headers Jul 22, 2020
@ioggstream
Copy link

In case you expose those headers, I suggest using this spec https://tools.ietf.org/html/draft-polli-ratelimit-headers-03 which is currently supported by various api gateway (kong, envoy proxy, redhat-3scale, ...) and some client libraries.

it just expresses X-RateLimit-Reset in delta-seconds instead of a timestamp: this reduces clock-skew issues and "thundering herd" problems at begin of period

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

No branches or pull requests

6 participants