Skip to main content

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


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 hashes)

Uploaded Source

Built Distribution

fastapi_extras-0.1.0-py3-none-any.whl (2.9 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