fix: sd_create_ticket — data=form-encoded как в service_desk

This commit is contained in:
Денис Кривоченко
2026-07-23 02:14:17 +07:00
parent 7517448508
commit 90bac4e343
+1 -1
View File
@@ -31,7 +31,7 @@ async def sd_create_ticket(login: str, subject: str, description: str) -> str:
html_desc = f"<p>{description}</p><br><hr><p style='color:#555;font-size:12px;'><i>Создано через TrueConf КЛЕВЕР</i></p>" html_desc = f"<p>{description}</p><br><hr><p style='color:#555;font-size:12px;'><i>Создано через TrueConf КЛЕВЕР</i></p>"
payload = {"request": {"subject": subject, "description": html_desc, "requester": {"email_id": DEFAULT_REQUESTER}, "udf_fields": {}}} payload = {"request": {"subject": subject, "description": html_desc, "requester": {"email_id": DEFAULT_REQUESTER}, "udf_fields": {}}}
async with httpx.AsyncClient(verify=False) as client: async with httpx.AsyncClient(verify=False) as client:
resp = await client.post(endpoint, headers=headers, content=json.dumps({"input_data": payload}), timeout=15.0) resp = await client.post(endpoint, headers=headers, data={"input_data": json.dumps(payload)}, timeout=15.0)
data = resp.json() data = resp.json()
if data.get("response_status", {}).get("status_code") == 2000: if data.get("response_status", {}).get("status_code") == 2000:
return str(data.get("request", {}).get("id")) return str(data.get("request", {}).get("id"))