WhoWhyWhen middleware for FastAPI
Project description
fastapi-whowhywhen
WhoWhyWhen middleware for FastAPI. Create a WhoWhyWhen account at https://whowhywhen.com/ and get your API key.
Installation
pip install fastapi-whowhywhen
Usage
from fastapi import FastAPI
from fastapi_whowhywhen import WhoWhyWhenMiddleware
from starlette.background import BackgroundTasks
app = FastAPI()
app.add_middleware(
WhoWhyWhenMiddleware,
api_key="YOUR_API_KEY"
)
@app.get("/")
async def root():
return {"message": "Hello, World!"}
# Add the following middleware to your FastAPI app
@app.middleware("http")
async def add_background_tasks(request: Request, call_next):
request.state.background_tasks = BackgroundTasks()
response = await call_next(request)
response.background = request.state.background_tasks
return response
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.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_whowhywhen-0.1.1.tar.gz.
File metadata
- Download URL: fastapi_whowhywhen-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ec534761ffc1a94d828630bf4c34e5fe6e5201ebfe3184a2c29616b28a2692f
|
|
| MD5 |
534b36286e3294ea08ed80e6f4726537
|
|
| BLAKE2b-256 |
9526cf06bfbc4af9806b5246cd3449b499337b3daeb91637920d86b26eb09562
|
File details
Details for the file fastapi_whowhywhen-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fastapi_whowhywhen-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb243e941b7d9fd995564a433a3b10504de1f8c295fa0cd17f45129d688c5018
|
|
| MD5 |
9059c953d1059658029e08c83a4b8789
|
|
| BLAKE2b-256 |
8e849639f9bb91beb5c869c154d79ecded8eff460c72c7f03531cdc8f2485c3f
|