# FastAPI health checks
Configurable health checks endpoints for FastAPI applications.
## Quickstart
```python
app = FastAPI()
app.include_router(
HealthcheckRouter(
Probe(
name="readiness",
checks=[
PostgreSqlCheck(host="db.example.com", username=..., password=...),
RedisCheck(host="redis.example.com", username=..., password=...),
],
),
Probe(
name="liveness",
checks=[
...,
],
),
),
prefix="/health",
)
```
The probes from this example will be available as `GET /health/readiness` and `GET /health/liveness`.
## Bundled checks
* `PostgreSqlCheck` – checks PostgreSQL server availability
* `RedisCheck` – checks Redis server availability
* `RabbitMqCheck` – checks RabbitMQ server availability
* `SettingsCheck` – validates settings models based on pydantic BaseModel
* `HttpCheck` – checks availability of specified URL
* `CephCheck` – checks Ceph server availability
## Custom checks
You can create your own checks by providing custom `fastapi_healthchecks.checks.Check` implementations. Like this:
```python
class MaintenanceCheck(Check):
async def __call__(self) -> CheckResult:
if is_maintenance():
return CheckResult(name="Maintenance", passed=False, details="Closed for maintenance")
else:
return CheckResult(name="Maintenance", passed=True)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "fastapi-healthchecks",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "fastapi,healthcheck",
"author": "RockITSoft",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/a0/49/17cee6fdca63962129b65352eb42107878c778becf74b0354a10048f5d69/fastapi_healthchecks-1.1.0.tar.gz",
"platform": null,
"description": "# FastAPI health checks\n\nConfigurable health checks endpoints for FastAPI applications.\n\n## Quickstart\n\n```python\napp = FastAPI()\napp.include_router(\n HealthcheckRouter(\n Probe(\n name=\"readiness\",\n checks=[\n PostgreSqlCheck(host=\"db.example.com\", username=..., password=...),\n RedisCheck(host=\"redis.example.com\", username=..., password=...),\n ],\n ),\n Probe(\n name=\"liveness\",\n checks=[\n ...,\n ],\n ),\n ),\n prefix=\"/health\",\n)\n```\n\nThe probes from this example will be available as `GET /health/readiness` and `GET /health/liveness`.\n\n## Bundled checks\n\n* `PostgreSqlCheck` \u2013 checks PostgreSQL server availability\n* `RedisCheck` \u2013 checks Redis server availability\n* `RabbitMqCheck` \u2013 checks RabbitMQ server availability\n* `SettingsCheck` \u2013 validates settings models based on pydantic BaseModel\n* `HttpCheck` \u2013 checks availability of specified URL\n* `CephCheck` \u2013 checks Ceph server availability\n\n## Custom checks\n\nYou can create your own checks by providing custom `fastapi_healthchecks.checks.Check` implementations. Like this:\n\n```python\nclass MaintenanceCheck(Check):\n async def __call__(self) -> CheckResult:\n if is_maintenance():\n return CheckResult(name=\"Maintenance\", passed=False, details=\"Closed for maintenance\")\n else:\n return CheckResult(name=\"Maintenance\", passed=True)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "FastAPI Healthchecks",
"version": "1.1.0",
"project_urls": null,
"split_keywords": [
"fastapi",
"healthcheck"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe0d7e2dc4363e52bb39fadb9314d6a755ff53263a4e389e551bd9bd0516ab18",
"md5": "073e8c1a7a005f644b5364dd88a9bee0",
"sha256": "4c75e5c7abddeb806ffd95219a73ab79d66435e47197ed4d710fd7f48af382c5"
},
"downloads": -1,
"filename": "fastapi_healthchecks-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "073e8c1a7a005f644b5364dd88a9bee0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 9920,
"upload_time": "2024-02-01T12:32:08",
"upload_time_iso_8601": "2024-02-01T12:32:08.242836Z",
"url": "https://files.pythonhosted.org/packages/fe/0d/7e2dc4363e52bb39fadb9314d6a755ff53263a4e389e551bd9bd0516ab18/fastapi_healthchecks-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a04917cee6fdca63962129b65352eb42107878c778becf74b0354a10048f5d69",
"md5": "8b73a477e4a0d6f48768fb7c09defd83",
"sha256": "2a2b12b9e18dadda78888cda4c0834fc6d3a4552e3a2c4ffad840f6e1dca24e3"
},
"downloads": -1,
"filename": "fastapi_healthchecks-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "8b73a477e4a0d6f48768fb7c09defd83",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 6536,
"upload_time": "2024-02-01T12:32:10",
"upload_time_iso_8601": "2024-02-01T12:32:10.806968Z",
"url": "https://files.pythonhosted.org/packages/a0/49/17cee6fdca63962129b65352eb42107878c778becf74b0354a10048f5d69/fastapi_healthchecks-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-01 12:32:10",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fastapi-healthchecks"
}