fastapi-idempotent
How to use package fastapi-idempotent
# Install package using poetry
poetry add fastapi-idempotent
# Using pip
pip install fastapi-idempotent
Set rate limit for FastAPI before starting server
Example code
- main.py
# Import package
from fastapi import FastAPI
from fastapi_idempotent import IdempotentMiddleWare
from core.config import settings # settings is class, where the configuration parameters are saved
from api.responses import JSONResponse
...
# Setup FastAPI
app = FastAPI(
title=settings.PROJECT_NAME,
version=settings.API_VERSION,
openapi_url=f"{settings.API_V1_PATH}/openapi.json",
default_response_class=JSONResponse,
)
Set idempotent for FastAPI
- Using redis storage
# Default idempotent expired is 10800s
app.add_middleware(
IdempotentMiddleWare,
redis_url=settings.IDEMPOTENT_STORAGE_URL, # type: str
)
or
app.add_middleware(
IdempotentMiddleWare,
idempotent_expired=settings.IDEMPOTENT_EXPIRED, # type: int
redis_url=settings.IDEMPOTENT_STORAGE_URL, # type: str
)
- Using memory storage
# Default idempotent expired is 10800s
app.add_middleware(
IdempotentMiddleWare,
testing=True, # type: bool
)
or
app.add_middleware(
IdempotentMiddleWare,
idempotent_expired=settings.IDEMPOTENT_EXPIRED, # type: int
testing=True, # type: bool
)
Metadata
Release files for fastapi-idempotent 0.0.3
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 |
|---|---|---|---|---|
| fastapi-idempotent-0.0.3.tar.gz | 6.4 kB | Without provenance | Details for fastapi-idempotent-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastapi_idempotent-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for fastapi_idempotent-0.0.3-py3-none-any.whl |
Total release size: 14.5 kB
Release files / fastapi-idempotent-0.0.3.tar.gz
| Download URL | fastapi-idempotent-0.0.3.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00c35d5b9d82f39036341f8094c2d7fccdb980cd4bc1f6ab5a53f1ac3d1745c9
|
|
BLAKE2b-256 checksum How to use checksums |
3393b2548a9371a1c8ea3ec55c171fa7bd395928e6a639b90d39937c49897201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Release files / fastapi_idempotent-0.0.3-py3-none-any.whl
| Download URL | fastapi_idempotent-0.0.3-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a71469df0f2aa436599cc4389e48e006a34209f37f6b6d1310bcf55c1f48e16
|
|
BLAKE2b-256 checksum How to use checksums |
c739e0431a5092d40337d0c761578c9a7d31085739161d7c9ff9f108ee79e102
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Security for fastapi-idempotent 0.0.3
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.