From 6c03ec4bf24c2f1d3c65dbd0e9d84b49bf705fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=A7=D0=B5=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Mon, 3 Nov 2025 21:29:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BA=D0=B0=D1=85=20=D0=B2=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=B8=D0=B7=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- get_data.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/get_data.py b/get_data.py index c05c88c..a56fa39 100644 --- a/get_data.py +++ b/get_data.py @@ -311,24 +311,25 @@ def get_data_from_API( ): did_first_fetch = False while not stop_event.is_set(): + current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") if stop_when_live and globals().get("STATUS") == "live" and did_first_fetch: - logger.info(f"[{name}] stopping because STATUS='live' and first fetch done") + logger.info(f"{[{current_time}]} [{name}] stopping because STATUS='live' and first fetch done") break start = time.time() try: value = requests.get(url, timeout=5).json() did_first_fetch = True # помечаем, что один заход сделали except json.JSONDecodeError as json_err: - logger.warning(f"[{name}] Ошибка парсинга JSON: {json_err}") + logger.warning(f"{[{current_time}]} [{name}] Ошибка парсинга JSON: {json_err}") value = {"error": f"JSON decode error: {json_err}"} except requests.exceptions.Timeout: - logger.warning(f"[{name}] Таймаут при запросе {url}") + logger.warning(f"{[{current_time}]} [{name}] Таймаут при запросе {url}") value = {"error": "timeout"} except requests.exceptions.RequestException as req_err: - logger.warning(f"[{name}] Ошибка запроса: {req_err}") + logger.warning(f"{[{current_time}]} [{name}] Ошибка запроса: {req_err}") value = {"error": str(req_err)} except Exception as ex: - logger.warning(f"[{name}] Неизвестная ошибка: {ex}") + logger.warning(f"{[{current_time}]} [{name}] Неизвестная ошибка: {ex}") value = {"error": str(ex)} # Проверяем, нет ли явного статуса ошибки в JSON