I am trying to integrate this to my django based web application.
From the documentation, I see we can use a decorator.
@Throttled(
key="/api/products",
using=RateLimiterType.TOKEN_BUCKET.value,
quota=rate_limiter.per_min(1),
store=store.RedisStore(server="redis://127.0.0.1:6379/0", options={"PASSWORD": ""}),
)
def products() -> list:
return [{"name": "iPhone"}, {"name": "MacBook"}]
We can put this in middleware, but that doesn't give granular control. i.e, for a specific endpoint. and all the args should be passed every time the decorator is called, creating duplicates for store attribute.
Is there a better way to integrate this with per view/per ip based throttling?
Is there a way the key can be dynamically set based on ip/user?
I am trying to integrate this to my django based web application.
From the documentation, I see we can use a decorator.
We can put this in middleware, but that doesn't give granular control. i.e, for a specific endpoint. and all the args should be passed every time the decorator is called, creating duplicates for
storeattribute.Is there a better way to integrate this with per view/per ip based throttling?
Is there a way the key can be dynamically set based on ip/user?