X-Rate-Limit headers
#2889
|
Is there any way to automatically set rate limiting based on the following HTTP Headers:
|
Answered by
Tomas2D
Oct 13, 2023
Replies: 1 comment 1 reply
|
Not automatically, but using a custom transport is a good approach for this kind of use-case... class RateLimitTransport(httpx.HTTPTransport):
def handle_request(self, request):
# apply per-domain rate limits
response = self.handle_request(request)
# inspect response headers, update per-domain rate limits
return response
client = httpx.Client(transport=RateLimitTransport()) |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for pointing out 👍🏻 . This is my working implementation ⬇️