This commit is contained in:
kiriharu 2021-03-31 10:45:55 +03:00
parent 153f22c927
commit 4ce150a42b

View File

@ -16,8 +16,8 @@ from .helpers import send_api_requests
from .validators import BaseValidator, LocalhostValidator from .validators import BaseValidator, LocalhostValidator
header = "Отчет о проверке хоста:" \ header = "Отчет о проверке хоста:" \
"\n\n— Хост: {target_fq}"\ "\n\n— Хост: {0}"\
f"\n— Дата проверки: {datetime.now():%d.%m.%y в %H:%M} (MSK)" # TODO: Get timezone "\n— Дата проверки: {1} (MSK)" # TODO: Get timezone
class SimpleCommandHandler: class SimpleCommandHandler:
@ -53,7 +53,11 @@ class CheckerBaseHandler(SimpleCommandHandler):
ts = time() ts = time()
ident = uuid4().hex ident = uuid4().hex
logger.info(f"User {chat_id} started check {ident}") logger.info(f"User {chat_id} started check {ident}")
rsp_msg = await bot.send_message(chat_id, header.format(**data)) # format header
rsp_msg = await bot.send_message(
chat_id,
header.format(data.get('target_fq'), datetime.now().strftime("%d.%m.%y в %H:%M"))
)
iter_keys = 1 # because I can't use enumerate iter_keys = 1 # because I can't use enumerate
# using generators for magic... # using generators for magic...
async for res in send_api_requests(self.api_endpoint, data, all_nodes): async for res in send_api_requests(self.api_endpoint, data, all_nodes):