| ⬅️ Back | 🏠 Docs Root |
The BaseApiClient is an asynchronous HTTP client wrapper built on top of httpx. It provides a standardized way for the Telegram Bot to communicate with external services (primarily the Django Backend API).
Located in: src/telegram_bot/core/api_client.py
def __init__(self, base_url: str, api_key: str | None = None, timeout: float = 10.0)
X-API-Key header._request (Internal)An asynchronous method to perform HTTP requests.
ApiClientError.The client uses a custom exception ApiClientError to wrap various underlying issues:
client = BaseApiClient(base_url="https://api.example.com", api_key="secret")
data = await client._request("GET", "/v1/data")