Skip to main content

watch your scripts go brr on telegram

Project description

telegram-logger

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 git+https://github.com/Mayukhdeb/telegram-logger.git

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.0.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.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tgtqdm-0.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 f654fe67f5542666da2f68e1da53e89af26ec61523fe170739236962db22ceff
MD5 003597e9475870f40a79fc59eaf19d5e
BLAKE2b-256 8f7355113dd451bdb8ec332f51d829130371ebf5be92eb22c88be1734e6ac29d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tgtqdm-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1fc279d91c5814d7b836aa9004af8adb6478b87a640a33f282bf27233cb1a0a
MD5 7b926dabc52ab8df31a360bc9fd73215
BLAKE2b-256 787bdb866724eaf901635396a4fbf6d89a8ca3180d53c7204ef029135b8b8aa8

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