What's the best way to rate limit specific graphql endpoints? #1172
Replies: 6 comments
-
Why not just use django-ratelimit? You can use the graphql endpoint with decorators, this is how I did it with csrf exemption:
|
Beta Was this translation helpful? Give feedback.
-
Hi @zbyte64 haven't tried it yet but doesn't that require a view class though? I was hoping I could do it on a per-mutation/query basis. i.e., I want to limit only my graphql/signup endpoint and not all graphql endpoints. |
Beta Was this translation helpful? Give feedback.
-
I see, in that case you would embed the |
Beta Was this translation helpful? Give feedback.
-
hmm, one solution could be a decorator that gets the class and resolver function |
Beta Was this translation helpful? Give feedback.
-
This snippet may help you |
Beta Was this translation helpful? Give feedback.
-
I wrote a simple tool: https://pypi.org/project/django-graphql-ratelimit/ |
Beta Was this translation helpful? Give feedback.
-
Is there a way to limit graphql endpoints? What are the current workarounds for this?
As a feature request, it might be a good idea to have something like https://django-ratelimit.readthedocs.io/en/v1.0.0/, where you can use decorators to ratelimit your APIs.
Beta Was this translation helpful? Give feedback.
All reactions