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[django]
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)
Django middleware
# settings.py
MIDDLEWARE = [
"watcherr.integrations.django_middleware.WatcherrMiddleware",
# ... other middleware
]
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.1.tar.gz
(7.6 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.1.tar.gz.
File metadata
- Download URL: watcherr-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ab8552256ee4f7275d9f0b931589696072ffddc886cf395f0378a08be7fdc6b
|
|
| MD5 |
7faed4f03ba6eedaaa52b74c343cfab1
|
|
| BLAKE2b-256 |
45c543534ba5390af47fb662ab8f18b838edf289e491d22ff2e548d82e28345e
|
File details
Details for the file watcherr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: watcherr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 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 |
154eaedc7f2bad62e75fe33da879e48831839afb617373df84ec1e338293c823
|
|
| MD5 |
0bd7fc41cc0ef2ada6b67aab1681e54c
|
|
| BLAKE2b-256 |
3e90ab7686c7afd9c00e5f8f90c44043f62558a7b52bbc9ce9a0929ee94dd44d
|