-
|
Is there any way to automatically set rate limiting based on the following HTTP Headers:
|
Beta Was this translation helpful? Give feedback.
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()) |
Beta Was this translation helpful? Give feedback.
Thanks for pointing out 👍🏻 . This is my working implementation ⬇️