Skip to main content

Error alerts via Telegram

Project description

error-alerts

Python error alerts via Telegram

Installation: pip install error-alerts

Options:

telegram_token: Bot Telegram token.

telegram_channel: Your Telegram channel ID where you want the alerts to be sent.

full_error: Send full traceback with line of code where error occurred (False by default and shown in sample below).

raise_error: Raise error and exit code when there is an error. If this is not set to True an alert will be sent and the code will continue running (False by default).

Usage:

from alerts import alerts

alerts = setup(
    telegram_token='TELEGRAM_TOKEN',
    telegram_channel=TELEGRAM_CHANNEL_ID,
    full_error=True,
    raise_error=True
    )

try:
    1 / 0
except Exception as error:
    alerts.send(title='Test', exception=error)

Output:

Test: Traceback (most recent call last):
  File "A:\Code\Python\packages\handler\test.py", line 6, in <module>
    1 / 0
ZeroDivisionError: division by zero

Prints that in console and sends a Telegram alert to the channel you specified

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

error-alerts-2.6.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file error-alerts-2.6.tar.gz.

File metadata

  • Download URL: error-alerts-2.6.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.9

File hashes

Hashes for error-alerts-2.6.tar.gz
Algorithm Hash digest
SHA256 080bd39d2bdcfb4ca308bacdf73c4d876abf19f43be6d1816a48327861697edd
MD5 352b5bc90763bef44792c1f629398c07
BLAKE2b-256 9a171ed9ed396938f4662ffdc12a7b6423b85a290d4847efa2d8a931923e4f58

See more details on using hashes here.

Supported by

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