New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fastapi-responses

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastapi-responses

Extend OpenAPI schema to collect HTTPExceptions.

  • 0.2.1
  • PyPI
  • Socket score

Maintainers
1

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc