问题标签 [flask-limiter]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
100 浏览

flask - 如何在 Flask-Classful 中设置 Flask-Limiter?

在我的create_app()函数中,我初始化了我的限制器:

问题是我进入RuntimeError: Working outside of application context.decorators = [. 我如何单独为我的每个方法使用限制器?并且还解决了这个错误?

0 投票
1 回答
411 浏览

python - Flask-Limiter is not called on Flask-Restful API's method_decorators

I've tried to follow some questions with no luck:

Due to outside of context issue I created a limiter function in a util.py file as follow:

And in my Flask-Restful API resource I have called this limiter in method-decorators:

NOTE: I'm using Flask version 2 and Flask-Limiter 1.4


EDIT-1:


EDIT-2: Here is the full working code that Flask-Limiter does not work on:

0 投票
0 回答
83 浏览

python - Tryind to create custom error response for flask_limiter in a flask restful app

I was trying to create a flask app with certain limits on a particular endpoint. I have defined my app structure like so:

  • run.py - >. to instantiate and run the flask server
  • limiter.py - > the ratelmiter config file containing.
  • service.py -> Using Flask Pluggable Views
  • app.py-> to include all the routes

The rate limit seems to work properly but i the custom errorhandler doesn't seem to work. what i am trying to achieve is to capture 429 error code and return it as some other code in 2xx group because of some limitation on my server side, but this doesn;t seem to work even when i place it in the limiter.py file similarly. I have been stuck at this for hours!. Any help would be appreciated!.

0 投票
1 回答
68 浏览

python - Flask-limiter - 如何找到 Flask-limiter 在 Redis 中存储的键名

我正在按用户限制我的应用程序。我想清除 redis 中给定用户的密钥。我怎样才能找到它是如何存储在 redis 中的。限制/存储中有一个明确的功能需要一个密钥,但我不知道密钥是如何存储在 Redis 中的

0 投票
2 回答
87 浏览

python - Flask-limiter - 在 redis 中添加自定义键名

如何更改 Flask-limiter 存储在 Redis 中的键名?

https://flask-limiter.readthedocs.io/en/stable/