Lightweight error alerting via Telegram
Project description
watcherr
Lightweight error alerting via Telegram for Python apps.
Install
pip install watcherr
Optional integrations:
pip install watcherr[fastapi]
pip install watcherr[celery]
pip install watcherr[all]
Setup
1. Get chat ID
WATCHERR_BOT_TOKEN=<your-token> watcherr
Send /start to the bot — it will reply with your chat_id.
2. Configure
Via code:
import watcherr
watcherr.configure(
bot_token="123456:ABC-DEF",
chat_id="-1001234567890",
service_name="my-api",
)
Or via .env:
WATCHERR_BOT_TOKEN=123456:ABC-DEF
WATCHERR_CHAT_ID=-1001234567890
WATCHERR_SERVICE_NAME=my-api
WATCHERR_ENVIRONMENT=production
Usage
import watcherr
watcherr.send_alert("Database connection failed", exc=exception)
watcherr.send_warning("Slow query", table="users", duration="5s")
watcherr.send_info("Deployed", version="1.2.0")
Logging handler
import logging
from watcherr.logging_handler import WatcherrHandler
logging.getLogger("myapp").addHandler(WatcherrHandler())
FastAPI middleware
from watcherr.integrations.fastapi_middleware import WatcherrMiddleware
app.add_middleware(WatcherrMiddleware)
Celery signals
from watcherr.integrations.celery_signals import setup_celery_alerts
setup_celery_alerts()
Config options
| Env variable | Default | Description |
|---|---|---|
WATCHERR_BOT_TOKEN |
— | Telegram bot token |
WATCHERR_CHAT_ID |
— | Telegram chat/group ID |
WATCHERR_SERVICE_NAME |
app |
Service name in alert title |
WATCHERR_ENVIRONMENT |
production |
Environment label |
WATCHERR_RATE_LIMIT |
60 |
Dedup window in seconds |
WATCHERR_ENABLED |
true |
Enable/disable sending |
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
watcherr-0.1.0.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file watcherr-0.1.0.tar.gz.
File metadata
- Download URL: watcherr-0.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e598da155b1e9348bedab4a94c6337505e5f9bfe9ae6f089cad5eb991367b2f
|
|
| MD5 |
0acdd1e3cb3e37d43dafb55b9282cbf1
|
|
| BLAKE2b-256 |
18287399905cb1bafbc274233a956b42cff2d6550f82a0bdfaeee2f8bfe9a2e2
|
File details
Details for the file watcherr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: watcherr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d17794d25a5bf4ccbefea51a765289ee5d2186a558b880c609692e2e4b86338a
|
|
| MD5 |
eea5ac79d8ade8fc135eb7bb22d25f1b
|
|
| BLAKE2b-256 |
76d8c469895112347810353676c65cfec476eb527321283b90019c19c1cf57c4
|