Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iunary/fastapi-maintenance-mode
FastAPI middleware for enabling maintenance mode
https://github.com/iunary/fastapi-maintenance-mode
fastapi fastapi-middleware maintenance maintenance-mode middleware python3 restapi
Last synced: 8 days ago
JSON representation
FastAPI middleware for enabling maintenance mode
- Host: GitHub
- URL: https://github.com/iunary/fastapi-maintenance-mode
- Owner: iunary
- License: mit
- Created: 2023-06-25T15:47:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-25T15:47:11.000Z (over 1 year ago)
- Last Synced: 2024-11-16T02:10:40.656Z (about 2 months ago)
- Topics: fastapi, fastapi-middleware, maintenance, maintenance-mode, middleware, python3, restapi
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`:
```shell
pip install fastapi-maintenance-mode
```## Example
```python
from fastapi import FastAPI
from fastapi_maintenance_mode import MaintenanceModeMiddlewareapp = FastAPI()
app.add_middleware(MaintenanceModeMiddleware, is_maintenance_mode=True)@app.get("/")
async def root():
return {"status": "Ok"}```