From 4e98dfede5f03dea7cadeb2df10a508f74af8004 Mon Sep 17 00:00:00 2001 From: Dev PC Date: Mon, 4 Aug 2025 19:06:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=81?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=D0=B0=D1=80=D1=8F=20=D0=BE=D1=82=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=B8=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- medods.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/medods.py b/medods.py index 7129ef3..5c75b28 100644 --- a/medods.py +++ b/medods.py @@ -1,4 +1,6 @@ +from datetime import datetime import logging +import os import config import json from aiohttp import ClientSession @@ -6,10 +8,13 @@ import aiohttp def loggingDict(title: str, data: dict) -> None: - logging.info( - f"{title}: %s", - json.dumps(data, indent=4, ensure_ascii=False).encode("utf-8").decode("utf-8"), - ) + call_id = data.get("call_session_id", "None") + today = datetime.now().strftime("%Y-%m-%d") + file_name = f"log/post/{today}/{call_id}.log" + if not os.path.exists(f"log/post/{today}"): + os.makedirs(f"log/post/{today}") + with open(file_name, "a") as f: + f.write(f"{title}:\n{json.dumps(data, indent=4)}\n\n") async def send_post_request(body: dict): @@ -68,7 +73,7 @@ async def call_started(call_session_id): body = { "status": "call_started", "call_session_id": call_session_id, - "responsibles": [777], + "responsibles": [{"id": 777}], } await send_post_request(body)