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.0a0.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for fastapi_extras-0.1.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b632aa1a590cb350886ea59adc37c63ee1d950c6b244bf18917e171a2cbcdcd |
|
MD5 | cb34904022e2955e208d1dfc794b5737 |
|
BLAKE2b-256 | c58b32a18630010d7d95d37d01f8aa2e265e0058238535e70bd66906e4ef573b |