Add Support to access Throttle Headers
@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.
@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. 👍
+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.
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