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.1.tar.gz (4.0 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.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tgtqdm-0.0.1.tar.gz
Algorithm Hash digest
SHA256 46c444e21049084f832605756859e7e987dc329cf67ff50dbe586e004069d880
MD5 bcf904a1320cd39b6c61734a474edd3d
BLAKE2b-256 b0d77df5c1fef85456b4b0c9cdf06a839f23b8c26b2fc7de9b5b4aa94bb43650

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tgtqdm-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a221588b6e100c27fe12b3a63cc9cb03c66a35e6754ad2253e0e30ea843a9f58
MD5 889119d79f2c42e8a126d096f2de91a7
BLAKE2b-256 ed1fbc42287145ae62e6d9baa6a391358152ad2b4bbb62994548e71948b33795

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