Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /descoped_authly /src /authly /api /health_router.py
| import logging | |
| import psycopg | |
| from fastapi import APIRouter, Depends | |
| from authly._version import __version__ | |
| from authly.core.dependencies import get_database_connection | |
| router = APIRouter() | |
| async def health_check(db_connection=Depends(get_database_connection)) -> dict[str, str]: | |
| try: | |
| async with db_connection.cursor() as cur: | |
| await cur.execute("SELECT txid_current()") | |
| _ = await cur.fetchone() | |
| # Include version and psycopg driver information | |
| health_info = { | |
| "status": "healthy", | |
| "version": __version__, | |
| "database": "connected", | |
| "psycopg_driver": psycopg.pq.__impl__, | |
| "psycopg_version": psycopg.__version__, | |
| } | |
| return health_info | |
| except Exception as e: | |
| logging.error("Database connection error: %s", str(e)) | |
| return {"status": "unhealthy", "version": __version__, "database": "error", "psycopg_driver": "unknown"} | |
Xet Storage Details
- Size:
- 1.01 kB
- Xet hash:
- 0f4c161dae2b2fb0a89f1cef452f408dd17aebd6a30bf81f1f21d6060956571e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.