fastapi-sanitizer-example
A configurable FastAPI middleware that sanitizes JSON request/response fields using bleach.
Quick usage
from fastapi import FastAPI
from fastapi_sanitizer import SanitizerMiddleware
app = FastAPI()
app.add_middleware(
SanitizerMiddleware,
allowed_tags=["b", "i", "u"],
script_allowed_fields=["code_snippet"],
whitelist_fields=["system_status"],
)
@app.post("/demo")
def demo(data: dict):
return {"received": data}
Metadata
Release files for fastapi-sanitize 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_sanitize-0.0.1.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_sanitize-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / fastapi_sanitize-0.0.1.tar.gz
| Download URL | fastapi_sanitize-0.0.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fa846b5768c24003e61091d94a7ab78c2515ce6020fda70f6c0448c583cd6ab
|
|
BLAKE2b-256 checksum How to use checksums |
c3fdba7b4a7f3900ca2a0945af5a662af0d33b3a5c26c85cd3426fe63f50e3bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / fastapi_sanitize-0.0.1-py3-none-any.whl
| Download URL | fastapi_sanitize-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5b66cbb115ba99c7656211f065474bf3f12184cae575c435291e4a1a11732c2
|
|
BLAKE2b-256 checksum How to use checksums |
2d58ded25811db0da6397e4625f182f1878139d98cc5c4568f84f4ddb9665d70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|