FastAPI Ratelimiter
[]
Documentation: https://fastapi-ratelimit.readthedocs.io/en/latest/
Quick start:
import asyncio
import aioredis
import uvicorn
from fastapi import FastAPI, Depends
from starlette.responses import JSONResponse
from fastapi_ratelimiter import RateLimited, RedisDependencyMarker
from fastapi_ratelimiter.strategies import BucketingRateLimitStrategy
app = FastAPI()
redis = aioredis.from_url("redis://localhost")
@app.get(
"/some_expensive_call", response_class=JSONResponse,
dependencies=[
Depends(RateLimited(BucketingRateLimitStrategy(rate="10/60s")))
]
)
async def handle_test_endpoint():
await asyncio.sleep(5)
return {"hello": "world"}
app.dependency_overrides[RedisDependencyMarker] = lambda: redis
if __name__ == '__main__':
uvicorn.run(app)
Metadata
Release files for fastapi-ratelimiter 0.0.2
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 | |
|---|---|---|---|---|
| fastapi-ratelimiter-0.0.2.tar.gz | 17.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_ratelimiter-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.8 kB
Release files / fastapi-ratelimiter-0.0.2.tar.gz
| Download URL | fastapi-ratelimiter-0.0.2.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f43b498d9de10c53d3612bede8619271143b2160d88421ac67c56770e84f4a94
|
|
BLAKE2b-256 checksum How to use checksums |
03c8ab0f2bcc4f6734688f560cb9cf4b72e3a83f6567944fa9b5fe9fb4d7d4fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.10 Linux/5.8.0-59-generic
|
Release files / fastapi_ratelimiter-0.0.2-py3-none-any.whl
| Download URL | fastapi_ratelimiter-0.0.2-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4101dcb1604303a862aa2fd7b1717d490569f51478d6a531f101bb76efb5c5e8
|
|
BLAKE2b-256 checksum How to use checksums |
027c1403f844243a51f2e7c4295f997724f8c11ded3ec4db30f2e5e8ff25de04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.10 Linux/5.8.0-59-generic
|
Security for fastapi-ratelimiter 0.0.2
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.