Skip to content

miniproto

Public API for miniproto.

  • event_loop — Explicit optimized asyncio event-loop selection.
  • AuthKeyExchange — Perform Telegram’s RSA- and DH-protected MTProto authorization handshake.
  • AuthKeyExchangeResult — Authenticated MTProto key material and metadata produced by an exchange.
  • AuthService — Run sign-in and data-center authorization flows for one client session.
  • Client — Async client facade for MTProto operations.
  • ClientConfig — Immutable client configuration for authentication, session storage, RPCs, updates, and media.
  • DeviceInfo — Application and device identity sent when initializing a Telegram session.
  • TransportConfig — Connection transport settings with validated timeouts and payload limits.
  • UpdateQueueOverflowPolicy — Public attribute miniproto.config.UpdateQueueOverflowPolicy.
  • QuickAckReceipt — Early transport-acknowledgement metadata for one encrypted send attempt.
  • AmbiguousRpcResult — The transport failed after an RPC may already have reached Telegram.
  • AuthError — Base exception for authentication and authorization flow failures.
  • AuthKeyNotFound — Authentication key is invalid, unregistered, or no longer available.
  • AuthKeyRegenerationRequired — Authentication key is duplicated or unsynchronized and must be replaced.
  • BadRequest — Classified client-side Telegram RPC error, normally status code 400.
  • ClientDisconnected — Raised when invocation cannot continue because the client disconnected.
  • DatacenterMigration — Telegram directs the request to dc_id for a named migration kind.
  • FloodWait — Telegram pacing failure that exposes the required wait duration in seconds.
  • Forbidden — Classified Telegram permission failure with status code 403.
  • InternalServerError — Classified retryable server failure, normally a 5xx RPC code.
  • InvalidCode — Authentication flow failure for a missing, expired, or invalid phone code.
  • InvalidDatacenter — Telegram rejects the current data centre, commonly before a migration hint.
  • InvokeError — Base exception for raw invocation failures before Telegram returns a typed RPC error.
  • NotFound — Classified Telegram missing-resource failure with status code 404.
  • PasswordInvalid — Authentication flow received an invalid two-factor password.
  • PasswordRequired — Authentication flow requires a configured two-factor password.
  • PendingRpcLimitExceeded — Raised when a sender has too many in-flight RPCs and cannot accept more.
  • RequestTimeout — Raised when the client-side request deadline expires.
  • ResultTypeMismatch — Raised when an RPC result does not match the requested result contract.
  • RpcError — Raw or classified Telegram RPC failure with redaction-safe diagnostics.
  • RpcTimeout — Classified Telegram-side or transport RPC timeout, commonly code -503.
  • SessionEnvelopeError — Raised when an encrypted session envelope fails validation or authentication.
  • SessionStorageError — Raised when session persistence cannot safely continue.
  • SignUpRequired — Authentication flow requires creating a Telegram account first.
  • TransportFlood — Raised for transport-level 429 responses, not ordinary RPC flood waits.
  • Unauthorized — Classified Telegram authorization failure with status code 401.
  • DecodedFileId — Decoded local file-id fields used to recreate a media location or input media.
  • FILE_ID_PREFIX — Public attribute miniproto.file_id.FILE_ID_PREFIX.
  • decode_file_id — Decode an mpf1_ file ID without contacting Telegram.
  • encode_file_id — Encode supported Telegram media or input locations into a local file ID.
  • input_media_from_file_id — Decode a file ID into Telegram input media.
  • is_file_id — Return whether a value has the miniproto file-id prefix.
  • media_from_file_id — Decode a local file ID into a reusable Media value.
  • try_encode_file_id — Best-effort variant of :func:encode_file_id.
  • CdnIntegrityError — Raised when a CDN range lacks valid FileHash coverage or verification fails.
  • MediaDownloadResult — Completed materialized-download metadata and optional in-memory payload.
  • MediaIntegrityError — Raised when declared file hashes or download-range invariants are violated.
  • MediaUploadResult — Completed upload metadata and the MTProto input-file reference to reuse.
  • iter_download — Stream an exact media range as ordered, bounded byte chunks.
  • InMemoryMetrics — Simple in-memory MetricsSink useful for tests and local diagnostics.
  • LogFormat — Public attribute miniproto.observability.LogFormat.
  • MemoryDelta — Start, end, and peak resource snapshots for one monitored interval.
  • MemoryMonitor — Collect resource snapshots and optionally manage a temporary tracemalloc session.
  • MetricEvent — Immutable metric event recorded with a unit, attributes, and wall-clock timestamp.
  • MetricsSink — Protocol implemented by destinations that accept metric events.
  • ResourceSnapshot — Point-in-time process and tracemalloc memory counters.
  • StructuredFormatter — Formatter that redacts structured events and optionally emits compact JSON.
  • configure_logging — Install one redacting handler on the miniproto root logger.
  • current_process_id — Return the current operating-system process identifier.
  • emit_event — Emit one structured miniproto event if the level is enabled.
  • get_logger — Return the root miniproto logger or a named child logger.
  • get_metrics_sink — Return the currently configured process-global metrics sink, if any.
  • process_rss_bytes — Return this process’s reported RSS/working-set byte count when available.
  • record_metric — Record a metric through the configured sink, suppressing sink failures.
  • resource_snapshot — Capture current RSS, active tracemalloc counters, and GC object count.
  • set_metrics_sink — Set the process-global metrics destination, or disable metric recording.
  • to_jsonable — Recursively convert supported observability values into JSON-compatible shapes.
  • AuthKey — Validated non-empty MTProto authorization key bound to a positive DC.
  • DCOption — One validated Telegram data-centre endpoint and optional transport secret.
  • PeerCacheEntry — Durable peer lookup metadata with a shallow-copied optional raw-field mapping.
  • SessionRecord — Complete versioned session state with frozen, shallow collection snapshots.
  • UpdateState — Monotonic Telegram update cursors and their latest server timestamp.
  • UserIdentity — Durable Telegram user identity with optional private contact metadata.
  • EncryptedSQLiteSessionStorage — Thread-safe SQLite persistence with per-domain authenticated encryption.
  • InMemorySessionStorage — Thread-safe in-process storage that snapshots all values by serialization.
  • SessionStorage — Async session persistence contract with atomic synchronous transforms.
  • SessionString — A bearer-secret string whose representation is always redacted.
  • SessionStringFormat — Public attribute miniproto.session.strings.SessionStringFormat.
  • export_session_string — Export a typed or decoded session record in a portable bearer format.
  • import_session_string — Import a native, Telethon v1, or Pyrogram string into a validated record.
  • Media — Normalized Telegram media descriptor used for upload and download helpers.
  • Message — Normalized Telegram message returned by high-level messaging helpers.
  • NewMessage — Update emitted for a newly received message.
  • Peer — Telegram peer reference suitable for high-level client operations.
  • Update — Base normalized update with a UTC creation timestamp and optional raw payload.
  • User — Normalized Telegram user returned by peer and authorization helpers.