fix: добавить логирование ответа API для отладки

This commit is contained in:
2026-07-15 16:16:14 +07:00
parent 88fca32156
commit f09b693218
+4 -1
View File
@@ -178,7 +178,10 @@ async def create_ticket_in_sd(requester_email: str, subject: str, description: s
if template_id: if template_id:
req_payload["request"]["request_template"] = {"id": template_id} req_payload["request"]["request_template"] = {"id": template_id}
async with httpx.AsyncClient(verify=False) as client: async with httpx.AsyncClient(verify=False) as client:
return await client.post(endpoint, headers=headers, json={"input_data": req_payload}, timeout=15.0) resp = await client.post(endpoint, headers=headers, json={"input_data": req_payload}, timeout=15.0)
if resp.status_code not in [200, 201]:
sd_workflow_logger.error(f"API Error: status={resp.status_code} body={resp.text}")
return resp
resp = await _send_req(requester_email, city) resp = await _send_req(requester_email, city)
data = resp.json() if resp.status_code in [200, 201] else {} data = resp.json() if resp.status_code in [200, 201] else {}
if data.get("response_status", {}).get("status_code") != 2000: if data.get("response_status", {}).get("status_code") != 2000: