I know and love flask-limiter
from older projects. Now I want to use it on my flask-restplus
based project.
My ultimate solution would enable me, to do rate limiting on a per method level. So different rates apply to a post than to a get method. But I would already be happy if I could define the limits on a per Resource (or even per Namespace) level. Important is that each resource would need its own rate limit.
My first try was to annotate the methods using @limiter.limit("1 per Minute")
. But that is completely ignored.
Next try than is using it on the namespace itself:
ns = api.namespace('something',
description='Operations related to maps and positions on a map',
decorators = [limiter.limit("1 Per Minute")]
)
Well, does not work either. But
ns = api.namespace('something',
description='Operations related to maps and positions on a map',
decorators = [limiter.limit]
)
does the thing. But leaves one problem open: I can only define one limiter per app. So I can only apply one limit rule to all my namespaces.
Any ideas on how I could make flask-restplus
accept the params passed to the limiter-decorator?
Or is there even a better way to manage rate-limiting in flask-resplus that I just did not see?