Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /ram07eng_airflow-watcher /src /airflow_watcher /api /envelope.py
| """Response envelope helpers for the Airflow Watcher API. | |
| Provides consistent JSON response structures for all API endpoints. | |
| """ | |
| from datetime import datetime, timezone | |
| from typing import Any | |
| def success_response(data: Any) -> dict: | |
| """Wrap data in a standard success envelope. | |
| Args: | |
| data: The response payload. | |
| Returns: | |
| ``{"status": "success", "data": ..., "timestamp": "..."}`` | |
| """ | |
| return { | |
| "status": "success", | |
| "data": data, | |
| "timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"), | |
| } | |
| def error_response(message: str) -> dict: | |
| """Wrap an error message in a standard error envelope. | |
| Args: | |
| message: Human-readable error description. | |
| Returns: | |
| ``{"status": "error", "error": ..., "timestamp": "..."}`` | |
| """ | |
| return { | |
| "status": "error", | |
| "error": message, | |
| "timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"), | |
| } | |
Xet Storage Details
- Size:
- 986 Bytes
- Xet hash:
- 54974a52f60f4b2b16c0651a9cd9d52327a28fc7b3d1c5f993a78e59d9401982
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.