Skip to main content

Error alerts via Telegram

Project description

error-alerts

Python error alerts via Telegram

Installation: pip install error-alerts

Options:

token: Bot Telegram token.

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 error_alerts import alerts

alerts = alerts(token='TELEGRAM_TOKEN', 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-6.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: error-alerts-6.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for error-alerts-6.2.tar.gz
Algorithm Hash digest
SHA256 c444a6707588257ab2e3c7a59c368ae827a5cae25a0b2cb98a75e7126919d6f2
MD5 39a98d33f2e2c2baa01633148f649371
BLAKE2b-256 53d3c967aa33c282159fb8236beebd0efbf6b6c938691160b8719e2382d2d813

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