Download core/endpoints/system_status_api.py from Kyrlos11/nniback: direct link, hf CLI and curl.
- Browser
- Download file 1.86 kB
-
https://huggingface.co/spaces/Kyrlos11/nniback/resolve/main/core/endpoints/system_status_api.py
- Command line
-
hf download hf://spaces/Kyrlos11/nniback/core/endpoints/system_status_api.py
-
curl -L -o system_status_api.py https://huggingface.co/spaces/Kyrlos11/nniback/resolve/main/core/endpoints/system_status_api.py
1.86 kB
| from fastapi import APIRouter | |
| from pydantic import BaseModel | |
| from typing import Optional, List, Literal | |
| from core.services.system_status import get_system_status | |
| router = APIRouter(prefix="/system", tags=["system"]) | |
| class MaintenanceNoticeResponse(BaseModel): | |
| enabled: bool | |
| startTime: Optional[str] = None | |
| endTime: Optional[str] = None | |
| class TechnicalIssueResponse(BaseModel): | |
| enabled: bool | |
| message: Optional[str] = None | |
| statusUrl: Optional[str] = None | |
| affectedServices: Optional[List[str]] = None | |
| description: Optional[str] = None | |
| estimatedResolution: Optional[str] = None | |
| severity: Optional[Literal["degraded", "outage", "maintenance"]] = None | |
| class SystemStatusResponse(BaseModel): | |
| maintenanceNotice: MaintenanceNoticeResponse | |
| technicalIssue: TechnicalIssueResponse | |
| updatedAt: Optional[str] = None | |
| async def get_public_system_status() -> SystemStatusResponse: | |
| status = await get_system_status() | |
| maintenance_notice = MaintenanceNoticeResponse( | |
| enabled=status.maintenance_notice.enabled, | |
| startTime=status.maintenance_notice.start_time, | |
| endTime=status.maintenance_notice.end_time | |
| ) | |
| technical_issue = TechnicalIssueResponse( | |
| enabled=status.technical_issue.enabled, | |
| message=status.technical_issue.message, | |
| statusUrl=status.technical_issue.status_url, | |
| affectedServices=status.technical_issue.affected_services, | |
| description=status.technical_issue.description, | |
| estimatedResolution=status.technical_issue.estimated_resolution, | |
| severity=status.technical_issue.severity | |
| ) | |
| return SystemStatusResponse( | |
| maintenanceNotice=maintenance_notice, | |
| technicalIssue=technical_issue, | |
| updatedAt=status.updated_at | |
| ) | |