# 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 MaintenanceModeMiddleware
app = FastAPI()
app.add_middleware(MaintenanceModeMiddleware, is_maintenance_mode=True)
@app.get("/")
async def root():
return {"status": "Ok"}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/iunary/fastapi-maintenance-mode",
"name": "fastapi-maintenance-mode",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Yusuf",
"author_email": "contact@yusuf.im",
"download_url": "https://files.pythonhosted.org/packages/b6/e7/183aa854fecd83a019de588f73f6c7aed5a3115f19872fb6a0de7fbf95b0/fastapi-maintenance-mode-1.0.0.tar.gz",
"platform": null,
"description": "# FastAPI Maintenance Mode Middleware\n\nFastAPI 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.\n\n## Installation\n\nYou can install the package using `pip`:\n\n```shell\npip install fastapi-maintenance-mode\n```\n\n## Example\n\n```python\nfrom fastapi import FastAPI\nfrom fastapi_maintenance_mode import MaintenanceModeMiddleware\n\napp = FastAPI()\napp.add_middleware(MaintenanceModeMiddleware, is_maintenance_mode=True)\n\n\n@app.get(\"/\")\nasync def root():\n return {\"status\": \"Ok\"}\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "FastAPI middleware for enabling maintenance mode",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/iunary/fastapi-maintenance-mode"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5d47dc26017eab0b5a581c8a604a27e4900facbedc1ad4cc0a3af30f78c6e7e6",
"md5": "15b8c4251130f5b64f2359f3a555401b",
"sha256": "979cc94feddf0448c0199f630011466f31a52859bf6148d4ccead0cd23575f46"
},
"downloads": -1,
"filename": "fastapi_maintenance_mode-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "15b8c4251130f5b64f2359f3a555401b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4472,
"upload_time": "2023-06-25T15:45:41",
"upload_time_iso_8601": "2023-06-25T15:45:41.338976Z",
"url": "https://files.pythonhosted.org/packages/5d/47/dc26017eab0b5a581c8a604a27e4900facbedc1ad4cc0a3af30f78c6e7e6/fastapi_maintenance_mode-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b6e7183aa854fecd83a019de588f73f6c7aed5a3115f19872fb6a0de7fbf95b0",
"md5": "8db1501b5416cbc38e420d581e35f12f",
"sha256": "be0cb8e193b64956e69d8649e0ccf988eba64a8dc315900929b315d5afc63769"
},
"downloads": -1,
"filename": "fastapi-maintenance-mode-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "8db1501b5416cbc38e420d581e35f12f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3208,
"upload_time": "2023-06-25T15:45:42",
"upload_time_iso_8601": "2023-06-25T15:45:42.974348Z",
"url": "https://files.pythonhosted.org/packages/b6/e7/183aa854fecd83a019de588f73f6c7aed5a3115f19872fb6a0de7fbf95b0/fastapi-maintenance-mode-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-25 15:45:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "iunary",
"github_project": "fastapi-maintenance-mode",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "fastapi-maintenance-mode"
}