Skip to main content

FastAPI middleware for enabling maintenance mode

Project description

FastAPI Maintenance Mode Middleware

FastAPI Maintenance Mode Middleware is a Python package that provides middleware for enabling maintenance mode in FastAPI applications. When maintenance mode is enabled, all incoming requests will receive a 503 Service Unavailable response indicating that the service is temporarily unavailable due to maintenance.

Installation

You can install the package using pip:

pip install fastapi-maintenance-mode

Example

from fastapi import FastAPI
from fastapi_maintenance_mode import MaintenanceModeMiddleware

app = FastAPI()
app.add_middleware(MaintenanceModeMiddleware, is_maintenance_mode=True)


@app.get("/")
async def root():
    return {"status": "Ok"}

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-maintenance-mode-1.0.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

fastapi_maintenance_mode-1.0.0-py3-none-any.whl (4.5 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