Provides asyncio storage and strategy implementations for the limits library.
Project description
alimits
Provides asyncio-compatible implementations of the limits
library storage and strategy options.
Used in the slowapi
library.
Documentation is available here.
Available on PyPi at alimits.
Strategies
This library implements a couple asyncio limiting strategies:
- Fixed window → (
alimits.strategies.AsyncFixedWindowRateLimiter
) - Moving window → (
alimits.strategies.AsyncMovingWindowRateLimiter
) - Fixed window with elastic expiration → (
alimits.strategies.AsyncFixedWindowElasticRateLimiter
)
Resources
- https://limits.readthedocs.io/en/stable/strategies.html
- https://medium.com/figma-design/an-alternative-approach-to-rate-limiting-f8a06cf7c94c
- https://cloud.google.com/architecture/rate-limiting-strategies-techniques
Storage Backends
Each of the above rate limiters support a couple different storage backends:
- Memory (in-memory, volatile) → (
alimits.storage.AsyncMemoryStorage
) - Redis (on-disk or in-memory, persistent) → (
alimits.storage.AsyncRedisStorage
)
Other storage backends are a WIP.
License
Copyright (c) 2021 Elias Gabriel, 2020 Laurent Savaete, 2015 Ali-Akber Saifee
This software is licensed under the MIT License.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the forest you’ll be creating employment for local families and restoring wildlife habitats.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.