Skip to content

Repository files navigation

progressreporting

Easy and live status updates to a Telegram chat using a bot.

Installation

pip install git+https://github.com/SengerM/progressreporting

Usage

See the examples directory.

Quick example:

fromprogressreporting.TelegramProgressReporterimportSafeTelegramReporter4Loopsfromtimeimportsleepreporter=SafeTelegramReporter4Loops(
bot_token="your_bot's_token",
chat_id='id_of_a_chat_where_your_bot_can_send_messages_to',
)
reporter.send_message('Send whatever message you like. 😃')
n_iterations=999withreporter.report_loop(n_iterations,'Give your loop a name',20):
forninrange(n_iterations):
sleep(60/n_iterations) # Here you would do some stuff, I will just sleep.reporter.update(1) # This line tells the reporter that one iteration has been completed, and automatically sends the updates once per minute to the Telegram chat.

Some screenshots

Example screenshot

Creating a bot

To create a Telegram bot you can follow any of the tutorials that are around.

To get the chat ID just talk to your bot, say "Hi", and then go to https://api.telegram.org/bot<YourBOTToken>/getUpdates. More info here.

About

Easily report the progress of a script to your mobile in real time!

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages