Skip to main content

watch your scripts go brr on telegram

Project description

tgtqdm

tgtqdm banner

who needs work-life balance when you can watch your logs on the phone?

I made this because I wanted to watch my scripts go brr while I'm away from my computer

pip install tgtqdm

Replace your tqdm bar with this:

import time
from tgtqdm import tgtqdm

for i in tgtqdm(
    range(33),
    json_filename="telegram_info.json",
    desc="running something"
):
    ## do something
    time.sleep(1)

The json file should look like this:

{
    "api_token": "TOKEN",
    "chat_id": 123456789
}

How do I get an API token and a chat ID?

You can also manually log messages like this:

from telegram_logger import TelegramLogger

logger = TelegramLogger(
    api_token="...",
    chat_id=123
)

## when you log for the first time, it will send a message
logger.log(message="Lettuce begin", timestamp=False)

## when you log again, it will update the existing message
logger.log(message="Legume resume", timestamp=False)

Alternatively, you can also safely store your api token and chat ID in a json and initialize your logger from the filename. This is usually safer for dummies

logger = TelegramLogger.from_json(
    filename="telegram_info.json"
)

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

tgtqdm-0.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tgtqdm-0.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file tgtqdm-0.0.2.tar.gz.

File metadata

  • Download URL: tgtqdm-0.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for tgtqdm-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2e8f2780faad9de7aeb649f6f42fef53681a59b0b4cf5782058dee1886b54799
MD5 ec76c1f7feafd700702d1dd444a4cdd8
BLAKE2b-256 6ccedec3a9eae3f854a0b7df438a311730e1fc4a24ccb6d74472fcf6cb43b551

See more details on using hashes here.

File details

Details for the file tgtqdm-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tgtqdm-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for tgtqdm-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd9627d5e5a915a8ef40f7bad642a71d0496133156d9176e198a72dd47ea60d1
MD5 46fc20f1865fb7f2587737322eb5e914
BLAKE2b-256 49d679cc38c90967d3f88849604cdd9b88b693a446e768d3265723291adbec4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page