Comments (4)
Sounds like you want to set a limit of 1/30seconds
with a moving-window
strategy:
limiter = Limiter(..., strategy="moving-window")
@limiter.limit("1/30seconds")
async def foo(request: Request)
pass
Note that I haven't tested this code, there could be bugs. Let me know if this works for you.
For more info, check limits
's docs on rate-limit-string-notation.
@laurentS Maybe there should be docs to describe the different supported strategies?
from slowapi.
The different strategies are documented in limit
s docs. Do you think we should duplicate this, or just point to it?
from slowapi.
okay, I got it. Thanks for all. And I think it is better to write down some strategies for beginners.
from slowapi.
The strategies are documented, but I was thinking about the string values of the strategies (fixed-window
, fixed-window-elastic-expiry
, moving-window
). These aren't mentioned in the limits
docs, except in the source code.
Maybe we could cross-reference to limits.strategies.STRATEGIES
in the docstrings?
from slowapi.
Related Issues (20)
- Can slowapi be used in production? HOT 1
- Is it possible to bump limitis package version up to 2.1? HOT 1
- @limiter.limit("1/second") not working HOT 5
- Do slowapi support rate limiting by parameters? HOT 1
- Encountered an error reporting: AttributeError: 'State' object has no attribute 'view_rate_limit' HOT 4
- Information on ratelimit-string HOT 3
- Error in production HOT 5
- How to call in APIRouter'? HOT 2
- Add support for python 3.11 HOT 6
- New release/tag HOT 2
- Can global limits make this in FastAPI? HOT 4
- [QUESTION] redis asyncio-compatible? HOT 2
- Installation failure with poetry.core 1.5
- Can't set RATELIMIT_DEFAULT in .env HOT 4
- Dependency Dashboard
- Hi @smittysmee this is not my day job, it's 100% volunteer work, so priority may fall behind. The process for publishing an update is a bit manual still. If you want to give a hand with opening a PR to prepare for a release 0.1.8, I think a lot of people will be grateful. Examples from past releases #120 or #108. As a policy (see #58 ), I add any contributor who's had at least one PR merged to the repo, to help reduce bottlenecks. You're welcome to join the team!
- Features
- Feature | Can this support individual limits by IP address or user token? HOT 1
- slowapi uses limits==2.8.0 which contains usage of deprecated pkg_resources
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slowapi.