Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Nostalgia-Season-Train_DesksetBack /src /deskset /router /unify /response.py
| from fastapi import Response | |
| import orjson | |
| from deskset.core.standard import DesksetError | |
| # ==== 返回 JSON ==== | |
| class DesksetRepJSON(Response): | |
| media_type = 'application/json' | |
| def render(self, content: object) -> bytes: | |
| response = { | |
| 'success': True, | |
| 'code': 0, | |
| 'message': 'Success', | |
| 'result': content | |
| } | |
| return orjson.dumps(response) | |
| # ==== 返回 DesksetError 错误 ==== | |
| class DesksetErrorRep(Response): | |
| media_type = 'application/json' | |
| def render(self, error: DesksetError) -> bytes: | |
| response = { | |
| 'success': False, | |
| 'code': error.code, | |
| 'message': error.message, | |
| 'result': error.data # 给用户展示的错误信息 | |
| } | |
| return orjson.dumps(response) | |
Xet Storage Details
- Size:
- 818 Bytes
- Xet hash:
- 6d2adcb5bd061e4484be529568add7523210786cef03a8bc6d5842619f730a8f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.