Skip to main content

FastAPI Responses

Latest Commit
Package version

Find HTTPExceptions and turn them into documented responses. :tada:

Installation

pip install fastapi-responses

Usage

The simplest use case happens when we have a single exception being raised. We don't want to document the possible response manually, so FastAPI Responses comes in handy.

from fastapi import FastAPI, HTTPException
from fastapi_responses import custom_openapi

app = FastAPI()

app.openapi = custom_openapi(app)

@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!"

Without FastAPI Responses

With FastAPI Responses

Roadmap

  • Extract HTTPException from stack.
  • Extract any exception and document based on the exception_handler container.
  • Accept Python objects on HTTPException instantiation.

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for fastapi-responses 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-responses 0.2.1
File Size Uploaded Provenance Actions
fastapi-responses-0.2.1.tar.gz 4.1 kB Without provenance Details for fastapi-responses-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-responses 0.2.1
File Interpreter ABI Platform Actions
fastapi_responses-0.2.1-py3-none-any.whl Python 3 none any Details for fastapi_responses-0.2.1-py3-none-any.whl

Total release size: 8.6 kB

Release files / fastapi-responses-0.2.1.tar.gz

Download URL fastapi-responses-0.2.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f40f626c03a886611043575b1d68df89cebfa342513248287ef72ce1af46ae5b
BLAKE2b-256 checksum
How to use checksums
5bb2157e6782c7accde82699d33b0216363ed632c062f67cfb2f801ac3072e70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.8.11 Linux/5.8.0-59-generic

Release files / fastapi_responses-0.2.1-py3-none-any.whl

Download URL fastapi_responses-0.2.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fad40993503de7196cd5625813dc8208f58d024239a774457097eb6aef70bf1b
BLAKE2b-256 checksum
How to use checksums
adb14f4d0e1094c931fd0e5203a47833cb0637881a8d1cdac773bf74c5a63c19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.8.11 Linux/5.8.0-59-generic

Security for fastapi-responses 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page