Lightweight error alerting via Telegram for Python apps. Integrates with FastAPI, Django, and Celery with rate limiting and retry support.
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.2.tar.gz
(9.5 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
watcherr-0.1.2-py3-none-any.whl
(11.1 kB
view details)
File details
Details for the file watcherr-0.1.2.tar.gz.
File metadata
- Download URL: watcherr-0.1.2.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
590acae23477739ea904ef0affe693c0faac1a9f7244667017e15124fe76ad04
|
|
| MD5 |
7ecce15b32b9eae08c73d5173aec59d4
|
|
| BLAKE2b-256 |
c76106f3d31a3831265fd3a0f641bec23409f57c1b7f8a3c928df3afebebf617
|
File details
Details for the file watcherr-0.1.2-py3-none-any.whl.
File metadata
- Download URL: watcherr-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.1 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 |
1542c397813337586d18dfb90fcdae7d6563aef875fbb5e04cac70f9e4da5946
|
|
| MD5 |
a579586c264dbc4c6008fcb8b3831fa9
|
|
| BLAKE2b-256 |
db4d855f5bfc0ae36b4e49d31b3ca686332a9b337b06971f23d2c180c96fe630
|