All Projects → laurentS → Slowapi

laurentS / Slowapi

Licence: mit
A rate limiter for Starlette and FastAPI

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Slowapi

Golimit
Golimit is Uber ringpop based distributed and decentralized rate limiter
Stars: ✭ 581 (+243.79%)
Mutual labels:  rate-limiter
Bottleneck
Job scheduler and rate limiter, supports Clustering
Stars: ✭ 1,113 (+558.58%)
Mutual labels:  rate-limiter
Bull
Premium Queue package for handling distributed jobs and messages in NodeJS.
Stars: ✭ 11,748 (+6851.48%)
Mutual labels:  rate-limiter
Resilience4j
Resilience4j is a fault tolerance library designed for Java8 and functional programming
Stars: ✭ 7,521 (+4350.3%)
Mutual labels:  rate-limiter
Bucket4j
Java rate limiting library based on token/leaky-bucket algorithm.
Stars: ✭ 1,025 (+506.51%)
Mutual labels:  rate-limiter
Nestjs Rate Limiter
Highly configurable rate limiter library built for NestJS
Stars: ✭ 93 (-44.97%)
Mutual labels:  rate-limiter
Hammer
An Elixir rate-limiter with pluggable backends
Stars: ✭ 366 (+116.57%)
Mutual labels:  rate-limiter
Portara
Portara directive is a rate limiter / throttler for GraphQL
Stars: ✭ 158 (-6.51%)
Mutual labels:  rate-limiter
Throttler
🔀⏳ Easy throttling with asyncio support
Stars: ✭ 60 (-64.5%)
Mutual labels:  rate-limiter
Guzzle Advanced Throttle
A Guzzle middleware that can throttle requests according to (multiple) defined rules. It is also possible to define a caching strategy, e.g. get the response from cache when the rate limit is exceeded or always get a cached value to spare your rate limits. Using wildcards in host names is also supported.
Stars: ✭ 120 (-28.99%)
Mutual labels:  rate-limiter
Rerate
redis-based rate counter and rate limiter
Stars: ✭ 18 (-89.35%)
Mutual labels:  rate-limiter
Exchange Rates
💱 Querying a rate-limited currency exchange API using Redis as a cache
Stars: ✭ 37 (-78.11%)
Mutual labels:  rate-limiter
Limiter
一个注解使你的SpringBoot项目获得分布式锁和限流器能力
Stars: ✭ 93 (-44.97%)
Mutual labels:  rate-limiter
Gubernator
High Performance Rate Limiting MicroService and Library
Stars: ✭ 609 (+260.36%)
Mutual labels:  rate-limiter
Curiefense
Curiefense is a unified, open source platform protecting cloud native applications.
Stars: ✭ 136 (-19.53%)
Mutual labels:  rate-limiter
Api Boot
“ ApiBoot”是为接口服务而生的,基于“ SpringBoot”完成扩展和自动配置,内部封装了一系列的开箱即用Starters。
Stars: ✭ 460 (+172.19%)
Mutual labels:  rate-limiter
Node Fast Ratelimit
☔️ Fast and efficient in-memory rate-limit for Node, used to alleviate most common DOS attacks.
Stars: ✭ 84 (-50.3%)
Mutual labels:  rate-limiter
Graphql Rate Limit
🚦 Fixed window rate limiting middleware for GraphQL. Use to limit repeated requests to queries and mutations.
Stars: ✭ 171 (+1.18%)
Mutual labels:  rate-limiter
Throttler
A rate limiting module for NestJS to work with Fastify, Express, GQL, Websockets, and RPC 🧭
Stars: ✭ 145 (-14.2%)
Mutual labels:  rate-limiter
Nginx Lua Redis Rate Measuring
A lua library to provide distributed rate measurement using nginx + redis, you can use it to do a throttling system within many nodes.
Stars: ✭ 109 (-35.5%)
Mutual labels:  rate-limiter

SlowApi

A rate limiting library for Starlette and FastAPI adapted from flask-limiter.

Note: this is alpha quality code still, the API may change, and things may fall apart while you try it.

The documentation is on read the docs.

Quick start

Installation

slowapi is available from pypi so you can install it as usual:

$ pip install slowapi

Features

Most feature are coming from (will come from) FlaskLimiter and the underlying limits.

Supported now:

  • Single and multiple limit decorator on endpoint functions to apply limits
  • redis, memcached and memory backends to track your limits (memory as a fallback)
  • support for sync and async HTTP endpoints
  • Support for shared limits across a set of routes

Limitations and known issues

  • The request argument must be explicitly passed to your endpoint, or slowapi won't be able to hook into it. In other words, write:
    @limiter.limit("5/minute")
    async def myendpoint(request: Request)
        pass

and not:

    @limiter.limit("5/minute")
    async def myendpoint()
        pass
  • websocket endpoints are not supported yet.

Developing and contributing

PRs are more than welcome! Please include tests for your changes :)

The package uses poetry to manage dependencies. To setup your dev env:

$ poetry install

To run the tests:

$ pytest

Credits

Credits go to flask-limiter of which SlowApi is a (still partial) adaptation to Starlette and FastAPI. It's also important to mention that the actual rate limiting work is done by limits, slowapi is just a wrapper around it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].