From fe140474d9e3a48f445a122b0cf2e6a6ba42a64c Mon Sep 17 00:00:00 2001 From: Dev PC Date: Tue, 5 Aug 2025 12:22:06 +0300 Subject: [PATCH] debug9 --- config.py | 2 +- medods.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index 6e5b5f3..376cd36 100644 --- a/config.py +++ b/config.py @@ -13,7 +13,7 @@ AMI_CHANNEL_FILTER = os.environ.get("AMI_CHANNEL_FILTER").split(", ") RECORDS_SERVER = os.environ.get("RECORDS_SERVER") MEDODS_SERVER = os.environ.get("MEDODS_SERVER") -MEDODS_TOKEN = os.environ.get("MEDODS_V1_TOKEN") +MEDODS_TOKEN = os.environ.get("MEDODS_TOKEN") DEBUG = os.environ.get("DEBUG", "False").lower() == "true" diff --git a/medods.py b/medods.py index eb6f552..c16a3f5 100644 --- a/medods.py +++ b/medods.py @@ -7,8 +7,7 @@ from aiohttp import ClientSession import aiohttp -def loggingDict(title: str, data: dict) -> None: - call_id = data.get("call_session_id", "None") +def loggingDict(title: str, data: dict, call_id: str) -> None: today = datetime.now().strftime("%Y-%m-%d") file_name = f"log/{today}/{call_id}.log" if not os.path.exists(f"log/{today}"): @@ -38,14 +37,15 @@ async def send_post_request(body: dict): logging.error(f"Request failed: {str(e)}") return None + call_id = body["call_session_id"] data = {"call": body} headers = { "Content-Type": "application/json", "Authorization": f"Bearer {config.MEDODS_TOKEN}", } if config.DEBUG: - loggingDict("Sending data to Medods", data) - loggingDict("Headers", headers) + loggingDict("Sending data to Medods", data, call_id) + loggingDict("Headers", headers, call_id) r = await post_request(url=config.MEDODS_SERVER, headers=headers, json=data) try: res = { @@ -55,7 +55,7 @@ async def send_post_request(body: dict): } except: res = {} - loggingDict("Recieved data from Medods:", res) + loggingDict("Recieved data from Medods:", res, call_id) else: await post_request(url=config.MEDODS_SERVER, headers=headers, json=data) @@ -92,7 +92,7 @@ async def call_lost(call_session_id): body = { "status": "call_lost", "call_session_id": call_session_id, - "responsibles": config.OPERATORS, + "responsibles": [{"id": 777}], } await send_post_request(body)