Skip to content

Implement the Health Check API pattern on your FastAPI application! 🚀

License

Notifications You must be signed in to change notification settings

conradogarciaberrotaran/fastapi-health

 
 

Repository files navigation

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.

About

Implement the Health Check API pattern on your FastAPI application! 🚀

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 81.5%
  • Makefile 18.5%