View fix (7)

This commit is contained in:
Luciano Gervasoni
2025-08-14 14:50:03 +02:00
parent bae5329b1e
commit 260a505766

View File

@@ -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]) )