修正ERP扫码登录服务签名契约
This commit is contained in:
@@ -51,16 +51,6 @@ def _scene(ticket: str, session_id: int | None) -> str:
|
||||
return scene
|
||||
|
||||
|
||||
def _erp_status_error_detail(response: httpx.Response) -> Any:
|
||||
try:
|
||||
data = response.json()
|
||||
except ValueError:
|
||||
return None
|
||||
if isinstance(data, dict):
|
||||
return data.get("detail")
|
||||
return None
|
||||
|
||||
|
||||
def _action_response(data: dict[str, Any]) -> ErpLoginActionResponse:
|
||||
return ErpLoginActionResponse(
|
||||
status=str(data.get("status") or ""),
|
||||
@@ -72,8 +62,7 @@ async def _read_erp_json(response: httpx.Response) -> dict[str, Any]:
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except httpx.HTTPStatusError as exc:
|
||||
detail = _erp_status_error_detail(exc.response) or "ERP扫码登录服务暂时不可用"
|
||||
raise HTTPException(status_code=502, detail=detail) from exc
|
||||
raise HTTPException(status_code=502, detail="ERP扫码登录服务暂时不可用") from exc
|
||||
try:
|
||||
data = response.json()
|
||||
except ValueError as exc:
|
||||
|
||||
Reference in New Issue
Block a user