From 260a50576652f54c29f9d7b0a4f999a45d8d3516 Mon Sep 17 00:00:00 2001 From: Luciano Gervasoni Date: Thu, 14 Aug 2025 14:50:03 +0200 Subject: [PATCH] View fix (7) --- app_urls/fetcher/views_base.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app_urls/fetcher/views_base.py b/app_urls/fetcher/views_base.py index 3a6b2ff..bc06e4c 100644 --- a/app_urls/fetcher/views_base.py +++ b/app_urls/fetcher/views_base.py @@ -111,16 +111,16 @@ def notify_status(request): bot_token = os.environ.get("TELEGRAM_BOT_TOKEN", "") chat_id = os.environ.get("TELEGRAM_CHAT_ID", "") - str_status = [urls_data_status] - readable_urls_data_status = json.dumps(list(urls_data_status), indent=2, default=str) - - # message = "During the last {} hours:\n{}\n{}\n{}".format(last_hours) message = "During the last {} hours:\n" + + message = "URLs per status:\n" for o in urls_data_status: message += " {}".format(o) + message = "URLs per source:\n" for o in urls_data_source: message += " {}".format(o) + message = "URLs per search:\n" for o in urls_data_search: message += " {}".format(o) @@ -135,16 +135,17 @@ def notify_status(request): # POST - response = requests.post(url, params={"chat_id": chat_id, "text": "Hola!"}) + # response = requests.post(url, params={"chat_id": chat_id, "text": "Hola!"}) response = requests.post(url, params=params) # print(response.json()) # Check the response + """ import json from django.forms.models import model_to_dict # readable_ = [model_to_dict(obj) for obj in urls_data_status] response = requests.post(url, params={"chat_id": chat_id, "text": str(readable)}) response = requests.post(url, params={"chat_id": chat_id, "text": str(readable_)}) - + """ return HttpResponse( "\n".join([str(e) for e in message]) ) \ No newline at end of file