simplelimiter
A simple FastAPI rate limiter
Requirements
How to use
Install the package
pip install simplelimiter
Example
import redis
from fastapi import FastAPI, APIRouter, Request
from fastapi.params import Depends
from simplelimiter import Limiter
app = FastAPI()
router = APIRouter()
# We initialize the Limiter on the app startup event
@app.on_event("startup")
async def startup():
r = redis.from_url("redis://localhost", encoding="utf-8", decode_responses=True)
Limiter.init(redis_instance=r, debug=True)
return app
# We pass the Limiter as a dependencie
@router.get("/", dependencies=[Depends(Limiter("5/minute"))])
def base_route(request: Request):
return {"response": "ok"}
app.include_router(router)
Metadata
Release files for simplelimiter 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simplelimiter-0.1.4.tar.gz | 2.7 kB | Without provenance | Details for simplelimiter-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simplelimiter-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for simplelimiter-0.1.4-py3-none-any.whl |
Total release size: 5.7 kB
Release files / simplelimiter-0.1.4.tar.gz
| Download URL | simplelimiter-0.1.4.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12844fc3eebb5b1cded48ce4a30beb891c6ab049eac0d2b3af82ed6a4e401266
|
|
BLAKE2b-256 checksum How to use checksums |
8bcd41ac320c632e3352a9b3f51413a090f6e2f7adbcb84189999c0147b92080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.5 Windows/10
|
Release files / simplelimiter-0.1.4-py3-none-any.whl
| Download URL | simplelimiter-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca09bfd044fd70173b0d7e930e393c3d260330110cae24a771226e50cce6f562
|
|
BLAKE2b-256 checksum How to use checksums |
c40a025e882d1442a80d3dbce030681f219f189fa13b2fcdaaf0b76e094ce399
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.5 Windows/10
|
Security for simplelimiter 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.