View fix (7)
This commit is contained in:
@@ -111,16 +111,16 @@ def notify_status(request):
|
|||||||
bot_token = os.environ.get("TELEGRAM_BOT_TOKEN", "")
|
bot_token = os.environ.get("TELEGRAM_BOT_TOKEN", "")
|
||||||
chat_id = os.environ.get("TELEGRAM_CHAT_ID", "")
|
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 = "During the last {} hours:\n"
|
||||||
|
|
||||||
|
message = "URLs per status:\n"
|
||||||
for o in urls_data_status:
|
for o in urls_data_status:
|
||||||
message += " {}".format(o)
|
message += " {}".format(o)
|
||||||
|
message = "URLs per source:\n"
|
||||||
for o in urls_data_source:
|
for o in urls_data_source:
|
||||||
message += " {}".format(o)
|
message += " {}".format(o)
|
||||||
|
message = "URLs per search:\n"
|
||||||
for o in urls_data_search:
|
for o in urls_data_search:
|
||||||
message += " {}".format(o)
|
message += " {}".format(o)
|
||||||
|
|
||||||
@@ -135,16 +135,17 @@ def notify_status(request):
|
|||||||
|
|
||||||
|
|
||||||
# POST
|
# 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)
|
response = requests.post(url, params=params)
|
||||||
# print(response.json()) # Check the response
|
# print(response.json()) # Check the response
|
||||||
|
|
||||||
|
"""
|
||||||
import json
|
import json
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
|
|
||||||
# readable_ = [model_to_dict(obj) for obj in urls_data_status]
|
# 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)})
|
||||||
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]) )
|
return HttpResponse( "\n".join([str(e) for e in message]) )
|
||||||
Reference in New Issue
Block a user