Coder Social home page Coder Social logo

Comments (4)

nootr avatar nootr commented on July 18, 2024 1

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.

laurentS avatar laurentS commented on July 18, 2024 1

The different strategies are documented in limits docs. Do you think we should duplicate this, or just point to it?

from slowapi.

moo611 avatar moo611 commented on July 18, 2024 1

okay, I got it. Thanks for all. And I think it is better to write down some strategies for beginners.

from slowapi.

nootr avatar nootr commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.