send telegram notification using a bot
Project description
telegram-coffee-break
It's time to take a coffee break! your python code is running, and you'll be notified through telegram when you will have your results.
Goal
Create a telegram bot that will send you notifications on your phone to follow your code progress.
Installation
pip install telegram-coffee-break
Preparation
** First: You will need to create a new telegram bot as follow: **
Go to the BotFather (if you open it in desktop, make sure you have the Telegram app), then create new bot by sending the /newbot command. Follow the steps until you get the username and token for your bot. You can go to your bot by accessing this URL: https://telegram.me/YOUR_BOT_USERNAME and your token should looks like this.
7044NNNNN:AAEtcZ*************
Keep the token safe in a file and set your bot.
** Next: You need to find your telegram ID **
Go to the userinfobot and send /start. He will give you your personal ID.
Id: 871NNNNN
First: lol
Last: lolilol
Lang: en
Usage example
from telegrambotalarm import TelegramBot
TOKEN = 'NNNNNNNNNN:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
MYID = 'NNNNNNNNN'
bot = TelegramBot(TOKEN, MYID)
bot.send_message('Your code is running')
... do modeling etc ...
message = {
train accuracy : train_acc,
test accuracy : test_acc
}
bot.send_message(message)
bot.send_image('decision_tree.png', caption=message)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for telegram-coffee-break-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d59dd2546a08bbbb3bc44a2035e327b7df213896d7d7137c98ea67211c232f2 |
|
MD5 | 349f6611f24df64985c2f1e6577f5846 |
|
BLAKE2b-256 | df0b03932b3a5d992909acf73b2b41867c88b00771907768b81890f36a71517a |
Hashes for telegram_coffee_break-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | baf13609318d9451c0102135ebf92b4b49002b6cb624dcc963d5ccc5f5c9ddf3 |
|
MD5 | a7bdc6927dea03314c71cb31d97009f5 |
|
BLAKE2b-256 | e60181b4462ac55332d8d9cdb4e45976e61f872ee50dfccb0f1081f97f8c72f5 |