diff --git a/instruct/handlers.py b/instruct/handlers.py index f7ccb65..ab22ade 100644 --- a/instruct/handlers.py +++ b/instruct/handlers.py @@ -25,13 +25,13 @@ logger = logging.getLogger(__name__) async def sd_create_ticket(login: str, subject: str, description: str) -> str: """Создать заявку в SD.""" - from config.config import SD_URL, SD_TOKEN + from config.config import SD_URL, SD_TOKEN, DEFAULT_REQUESTER headers = {"authtoken": SD_TOKEN, "Accept": "application/vnd.manageengine.sdp.v3+json"} endpoint = f"{SD_URL}/api/v3/requests" html_desc = f"

{description}



Создано через TrueConf КЛЕВЕР

" - payload = {"request": {"subject": subject, "description": html_desc, "requester": {"email_id": None}, "udf_fields": {}}} + payload = {"request": {"subject": subject, "description": html_desc, "requester": {"email_id": DEFAULT_REQUESTER}, "udf_fields": {}}} async with httpx.AsyncClient(verify=False) as client: - resp = await client.post(endpoint, headers=headers, data={"input_data": json.dumps(payload)}, timeout=15.0) + resp = await client.post(endpoint, headers=headers, content=json.dumps({"input_data": payload}), timeout=15.0) data = resp.json() if data.get("response_status", {}).get("status_code") == 2000: return str(data.get("request", {}).get("id"))