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 details)
Built Distribution
File details
Details for the file fastapi_extras-0.1.0.tar.gz
.
File metadata
- Download URL: fastapi_extras-0.1.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.6.10-76060610-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 537eaa089dabe3e7a086eb60bcd90e10d5ab71ae6d6663e95f065783eb1b965f |
|
MD5 | 88fa1e4763bfc12d1874713f3ced6d05 |
|
BLAKE2b-256 | 00ccee3d9aa1426dd22e6809e7697877e8e19afb5f74730b500a3640ecd6a183 |
File details
Details for the file fastapi_extras-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: fastapi_extras-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.6.10-76060610-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c37f1589e3a8b115ca4718db614be801b45f5488815f79f55ecaaecaaaf61b6c |
|
MD5 | 82d79c22612edcb7e195f924df2745f3 |
|
BLAKE2b-256 | 91d2ab9f06f19f94705fc10387c454fba66ca5931608eae2bb56f9199aeee21b |