Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /noimank_easyths /easyths /api /responses.py
| """API 层公共响应工具""" | |
| from fastapi.responses import JSONResponse | |
| from easyths.models.operations import APIResponse, ErrorCode | |
| def json_response(envelope: APIResponse, status_code: int) -> JSONResponse: | |
| """以统一信封构造 JSON 响应""" | |
| return JSONResponse( | |
| status_code=status_code, content=envelope.model_dump(mode="json") | |
| ) | |
| def error_response( | |
| status_code: int, message: str, error_code: ErrorCode | |
| ) -> JSONResponse: | |
| """以统一信封构造错误响应(替代 HTTPException 的 {detail} 格式)""" | |
| return json_response( | |
| APIResponse(success=False, message=message, error_code=error_code), status_code | |
| ) | |
Xet Storage Details
- Size:
- 695 Bytes
- Xet hash:
- 048c7c206181f78d47e1b25efc6dd8b1b68a78f371b50b9f576eb0a2d1df34b1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.