Skip to main content

Extend OpenAPI schema to collect HTTPExceptions.

Project description

FastAPI Responses

Latest Commit

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi-responses-0.1.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

fastapi_responses-0.1.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page