send message async

This commit is contained in:
Omar Sánchez Pizarro
2023-10-09 14:55:54 +02:00
parent 4f1aea3139
commit 6020ce5acb
5 changed files with 9 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
import asyncio
import requests, json, pytz
from datetime import datetime
from time import sleep
@@ -34,11 +36,11 @@ class timenetManager:
return requests.post(furl, data=data, headers=headers)
def addMessage(self, message):
print(message)
self.message_acumulator += message + "\n"
def sendReport(self):
self.telegram.sendMessage(self.message_acumulator)
# self.telegram.sendMessage(self.message_acumulator)
asyncio.run(self.telegram.sendMessage(self.message_acumulator))
def updateTime(self):
self.headers["tn-d"] = "\"" + datetime.now().astimezone(pytz.UTC).strftime("%Y-%m-%dT%H:%M:%SZ") + "\""