Skip to main content

Heath check on FastAPI applications.

Project description

FastAPI Health 🚑️

Latest Commit
Package version

The goal of this package is to help you to implement the Health Check API pattern.

Installation

pip install fastapi-health

Usage

Using this package, you can create the health check endpoint dynamically using different conditions. Each condition is a callable and you can even have dependencies inside of it.

from fastapi import FastAPI, Depends
from fastapi_health import health

def get_session():
    return True

def is_database_online(session: bool = Depends(get_session)):
    return session

app = FastAPI()
app.add_api_route("/health", health([is_database_online]))

The /health endpoint on the example can return two possible response status code:

  • 200 (Ok): conditions are satisfied.
  • 503 (Service Unavailable): at least one condition is false.

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-health-0.3.1.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

fastapi_health-0.3.1-py3-none-any.whl (3.4 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