add some doc

This commit is contained in:
Marcel Dechert 2020-12-13 22:33:24 +01:00
parent 1b48ff1e79
commit 51fc3fb486
2 changed files with 11 additions and 8 deletions

View File

@ -6,12 +6,13 @@ TELEGRAM_TOKEN_ID = '1456847960:AAHF6ZVfPrPedN07-Z0FlbtFzuUgpQM3iO4' # token-id
TELEGRAM_CHAT_ID = '291512617' # chat-id TELEGRAM_CHAT_ID = '291512617' # chat-id
# ---------------- # ----------------
# using https://github.com/gvalvano/telegram-notification
def send_notifaction(timestamp): def send_notification(timestamp):
# - - - - - - - - - - """ sends Telegram notification
# Telegram notification: using https://github.com/gvalvano/telegram-notification
"""
formatted_timestamp = timestamp.strftime("%d.%m.%Y, %H:%M:%S") formatted_timestamp = timestamp.strftime("%d.%m.%Y, %H:%M:%S")
msg = "<b>Es hat geklingelt </b> \nTimestamp: {}".format(formatted_timestamp) msg = "<b>Es hat geklingelt! </b> \nTimestamp: {}".format(formatted_timestamp)
telegram_notifier.basic_notifier(logger_name='training_notifier', telegram_notifier.basic_notifier(logger_name='training_notifier',
token_id=TELEGRAM_TOKEN_ID, token_id=TELEGRAM_TOKEN_ID,
chat_id=TELEGRAM_CHAT_ID, chat_id=TELEGRAM_CHAT_ID,

View File

@ -4,11 +4,13 @@ import unittest
import telegram_bot import telegram_bot
import datetime import datetime
class TestGetDataFromRKI(unittest.TestCase):
def test_send_notifaction(self): class SendTestMessageToSwaghausenBot(unittest.TestCase):
def test_send_notifaction(self):
timestamp = datetime.datetime.now() timestamp = datetime.datetime.now()
telegram_bot.send_notifaction(timestamp) telegram_bot.send_notification(timestamp)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()