From 4b5dd28fc8439d54112632997db9f1583625502a Mon Sep 17 00:00:00 2001 From: apthagowda97 Date: Thu, 26 Mar 2020 17:48:19 +0530 Subject: [PATCH 1/3] added telegram_print function to telegram_sender.py --- knockknock/telegram_sender.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/knockknock/telegram_sender.py b/knockknock/telegram_sender.py index a3f91aa..a007ac9 100644 --- a/knockknock/telegram_sender.py +++ b/knockknock/telegram_sender.py @@ -95,3 +95,10 @@ def wrapper_sender(*args, **kwargs): return wrapper_sender return decorator_sender + + +def telegram_print(text:str,token: str, chat_id: int): + # telegram print sends the message to the telegram + # Ex: It can be used to send loss,accuracy during each epoch + bot = telegram.Bot(token=token) + bot.send_message(chat_id=chat_id, text=text) \ No newline at end of file From 2b67cbf141a8558433ef7974b07fbdde08db5dc1 Mon Sep 17 00:00:00 2001 From: apthagowda97 Date: Thu, 26 Mar 2020 17:59:09 +0530 Subject: [PATCH 2/3] updated readme for telegram_print --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 660ce97..943e534 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,11 @@ def train_your_nicest_model(your_nicest_parameters): import time time.sleep(10000) return {'loss': 0.9} # Optional return value + +#For sending direct message to telegram(Optional) +from knockknock import telegram_print + +telegram_print(text="",token=token="", chat_id=CHAT_ID) ``` #### Command-line From 6e954933935676f89ae0259bc0a102661f94b807 Mon Sep 17 00:00:00 2001 From: apthagowda97 Date: Thu, 26 Mar 2020 18:01:43 +0530 Subject: [PATCH 3/3] updated readme for telegram_print --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 943e534..4a5a291 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ def train_your_nicest_model(your_nicest_parameters): #For sending direct message to telegram(Optional) from knockknock import telegram_print -telegram_print(text="",token=token="", chat_id=CHAT_ID) +telegram_print(text="",token="", chat_id=CHAT_ID) ``` #### Command-line