Skip to content

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

License

Notifications You must be signed in to change notification settings

SengerM/progressreporting

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:

from progressreporting.TelegramProgressReporter import SafeTelegramReporter4Loops
from time import sleep

reporter = 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 = 999
with reporter.report_loop(n_iterations,'Give your loop a name',20):
	for n in range(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

License

Stars

Watchers

Forks

Packages

No packages published

Languages