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 telegrambot 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.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7818cd3541eec907fa277259329ba515547e529002d509c258ce0ab841498ba7 |
|
MD5 | 9287c3e120ff11460588802470329ee2 |
|
BLAKE2b-256 | f7e14b3aa6c048015a4609ae5c24d02fad21386e9e4b7c225d9866d2985ec6ee |
Hashes for telegram_coffee_break-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc5510d79fbdb8ddfdca7d63e5c6c6d68f85f130739d6612438a9b0b413d610 |
|
MD5 | d09fd62b242d576c1858d14a224e1601 |
|
BLAKE2b-256 | 50c46ca57ca382b93174d0cb7fd984336b3e90d65cb7a94065cc6a6f7f8922a3 |