Extend OpenAPI schema to collect HTTPExceptions.
Project description
FastAPI Responses
This package is not stable. Do not use in production!
The goal of this package is to have your responses up-to-date according to your exceptions.
Installation
pip install fastapi-responses
Usage
from fastapi import FastAPI, HTTPException
from fastapi_responses import custom_openapi
app = FastAPI()
app.openapi = custom_openapi
@app.get("/{item_id}")
def get_item(item_id: int):
if item_id == 0:
raise HTTPException(status_code=404, detail="Item not found.")
return "Item exists!"
license
This project is licensed under the terms of the MIT license.
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
File details
Details for the file fastapi-responses-0.1.0.tar.gz
.
File metadata
- Download URL: fastapi-responses-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-56-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 385a743430edc86da27f75b5f10ccde4cee69f690046d05772b44733952f295c |
|
MD5 | db6a858328c5b601e8eb39ff06d405f0 |
|
BLAKE2b-256 | 8080429af3a1368c85bd22d4be6e9c2365bacfa9dd5cf69645cb0542befb4a54 |
File details
Details for the file fastapi_responses-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: fastapi_responses-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-56-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e87eb4f7389910ec010a11cc1634acdad10987f58867a3ec59959da420b347cc |
|
MD5 | d1c5db55272a002c5ca4b30e003bdb41 |
|
BLAKE2b-256 | da73c71b419dbe5cb9d41f6f84141ae03bc940db909d4d233efd67c6df972e94 |