python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
https://flask-restx.readthedocs.io/en/latest/
Other
2.14k stars 333 forks source link

Flask Limiter Integration #576

Open diogper opened 11 months ago

diogper commented 11 months ago

Any advise on a working rate limiter for flask-restx? I was trying to integrate flask-limiter in flask-restx, but apparently the recent versions require Flask>2.0.0 which becomes incompatible. I even tried using the version 1.5 which is the 1.x branch latest release, but for some reason I am unable to use the decorator for rate granularity, it only works with the default rate on the constructor. I assume this is because of the way requests are organized onto classes in flask-restx and not direct routes or blueprints like the native Flask.

Appreciate your time! Thank you.

peter-doggart commented 11 months ago

Have you tried specifying the decorators for class-based views as detailed here?: https://flask-limiter.readthedocs.io/en/stable/recipes.html#rate-limiting-class-based-views

diogper commented 11 months ago

I actually did not. I will try that. Though it seems theres less flexibility with that approach.

Thank you.