miniproto.config.ClientConfig
miniproto.config.ClientConfig
Section titled “miniproto.config.ClientConfig”ClientConfig(api_id: int, api_hash: str, session_storage: SessionStorage | None = None, session_path: str | os.PathLike[str] = 'miniproto.session.sqlite', transport: TransportConfig = TransportConfig(), device: DeviceInfo = DeviceInfo(), update_queue_size: int = 1000, update_queue_overflow: UpdateQueueOverflowPolicy = 'raise', update_duplicate_window: int = 2048, dc_id: int = 2, test_mode: bool = False, request_timeout: float = 30.0, max_request_retries: int = 2, max_reconnect_attempts: int | None = None, max_pending_rpcs: int = 512, flood_sleep_threshold: int | None = None, method_flood_cache_size: int = 512, media_concurrency: int | None = None, media_max_buffer_size: int | None = None, media_download_max_in_flight_bytes_per_dc: int = 16 * 1024 * 1024, media_upload_max_in_flight_bytes_per_dc: int = 8 * 1024 * 1024, media_download_small_queue_limit: int | None = None, media_download_large_queue_limit: int | None = None, media_idle_close: float | None = 120.0, bot_token: str | None = None) -> NoneImmutable client configuration for authentication, session storage, RPCs, updates, and media.
Parameters:
- api_id (
int) – Positive Telegram application identifier. - api_hash (
str) – Telegram application secret; excluded from representations. - session_storage (
SessionStorage | None) – Optional session backend. When omitted, the client uses encrypted SQLite storage atsession_path. - session_path (
str | PathLike[str]) – Path for the default encrypted SQLite session, defaulting to"miniproto.session.sqlite". - transport (
TransportConfig) – TCP transport configuration. - device (
DeviceInfo) – Telegram-facing device metadata. - update_queue_size (
int) – Bounded number of pending updates, defaulting to 1000. - update_queue_overflow (
UpdateQueueOverflowPolicy) – Overflow action:"raise","drop_oldest", or"drop_newest". - update_duplicate_window (
int) – Number of recent updates retained for duplicate suppression. - dc_id (
int) – Initial Telegram datacenter identifier, defaulting to 2. - test_mode (
bool) – Select Telegram’s test environment when true. - request_timeout (
float) – Default per-request timeout in seconds. - max_request_retries (
int) – Maximum automatic retries for eligible RPCs. - max_reconnect_attempts (
int | None) – Optional cap for transport reconnections. - max_pending_rpcs (
int) – Maximum concurrently pending RPCs. - flood_sleep_threshold (
int | None) – Maximum flood-wait duration to sleep automatically;Noneuses the default retry policy. - method_flood_cache_size (
int) – Number of method flood-wait entries to remember. - media_concurrency (
int | None) – Optional default concurrent media requests. - media_max_buffer_size (
int | None) – Optional media buffering cap in bytes. - media_download_max_in_flight_bytes_per_dc (
int) – Per-DC download scheduler byte budget. - media_upload_max_in_flight_bytes_per_dc (
int) – Per-DC upload scheduler byte budget. - media_download_small_queue_limit (
int | None) – Optional small-download queue limit. - media_download_large_queue_limit (
int | None) – Optional large-download queue limit. - media_idle_close (
float | None) – Seconds before unused media lanes close;Nonekeeps them open for the client lifetime. - bot_token (
str | None) – Optional bot token, excluded from representations.
Raises:
ValueError– If required identifiers or secrets are empty, limits are invalid, or a media scheduler budget is below 64 KiB.
Security
api_hash, bot_token, and the supplied storage backend are hidden from the dataclass representation, but callers remain responsible for protecting configuration values and session storage.