A collection of utilities for FastAPI
Project description
FastAPI Extras
This package provides some extra utilities for FastAPI.
Installation
pip install fastapi-extras
Usage
Error Handling
from fastapi import FastAPI
from fastapi_extras.errors import configure_error_handlers, BadRequestError
app = FastAPI()
configure_error_handlers(app)
@app.get("/error")
def error():
raise BadRequestError("This is a bad request", detail={"reason": "You did something wrong"})
"""
{
"status": 400,
"title": "BadRequest",
"message": "This is a bad request",
"detail": {
"reason": "You did something wrong"
},
}
"""
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
fastapi_extras-0.1.0.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for fastapi_extras-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c37f1589e3a8b115ca4718db614be801b45f5488815f79f55ecaaecaaaf61b6c |
|
MD5 | 82d79c22612edcb7e195f924df2745f3 |
|
BLAKE2b-256 | 91d2ab9f06f19f94705fc10387c454fba66ca5931608eae2bb56f9199aeee21b |