Skip to content

v1.0.1 — Telegram Retry & Token Redaction

Latest

Choose a tag to compare

@fdsimoes-git fdsimoes-git released this 13 May 14:06
5ac0f1e

Patch release hardening the Telegram transport layer. Closes #3.

Fixes

Automatic retry on transient failures

  • New _retry_transient() helper retries Telegram API calls on ConnectionError, 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 from HTTPError stringification
  • 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 JSON ok field beyond raise_for_status() — catches HTTP 200 with ok:false (e.g. "message to edit not found")
  • New _TelegramAPIError exception for application-level Telegram errors

Logging improvements

  • _edit_status() failure log level raised from debugwarning for 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