Patch release hardening the Telegram transport layer. Closes #3.
Fixes
Automatic retry on transient failures
- New
_retry_transient()helper retries Telegram API calls onConnectionError,Timeout, 5xx, and 429 (rate-limit) - Applied to
_edit_status(),_answer_callback(), and_edit_message_remove_keyboard() - Tight bounds (1 retry, 0.5–1s backoff) to stay well under the 30s long-poll cadence
Bot-token redaction in logs
- New
_redact()strips bot tokens from Telegram URLs before logging — prevents credential leaks fromHTTPErrorstringification - Covers both
/bot<TOKEN>/and/file/bot<TOKEN>/URL shapes - Applied to all 8 exception-logging sites in the bot
Stricter Telegram response validation
- New
_check_telegram_ok()validates the JSONokfield beyondraise_for_status()— catches HTTP 200 withok:false(e.g. "message to edit not found") - New
_TelegramAPIErrorexception for application-level Telegram errors
Logging improvements
_edit_status()failure log level raised fromdebug→warningfor production visibility
Documentation
- Added MIT LICENSE file
- New project cover image
- README refreshed with shields.io badge
Tests
- 266 new lines covering retry logic,
_check_telegram_ok, and_redact(8 sanitization scenarios) - All 189 tests passing
Full diff: v1.0.0...v1.0.1