miniproto.connection.sender.MTProtoSender.request
miniproto.connection.sender.MTProtoSender.request
Section titled “miniproto.connection.sender.MTProtoSender.request”request(body: bytes | object, *, content_related: bool = True, retry_safe: bool = False, request_timeout: float | None = None, quick_ack: bool = False, quick_ack_callback: Callable[[QuickAckReceipt], None] | None = None) -> objectSend one RPC and await its decoded result with safe retry controls.
Parameters:
- body (
bytes | object) – Encoded MTProto bytes or a serializable TL request object. - content_related (
bool) – Allocate a content-related sequence number; defaults toTrue. - retry_safe (
bool) – Permit automatic resend with a fresh message ID after a transport loss; defaults toFalseto avoid duplicating unknown-side-effect RPCs. - request_timeout (
float | None) – Optional caller wait bound in seconds.Nonewaits until a result, lifecycle failure, or cancellation. - quick_ack (
bool) – Request a transport quick ACK for the encrypted attempt; defaults toFalseand never completes this RPC by itself. - quick_ack_callback (
Callable[[QuickAckReceipt], None] | None) – Optional synchronous callback receiving the first non-stale :class:QuickAckReceipt; supplying it also requests an ACK. Callback failures are isolated and recorded.
Returns:
Raises:
PendingRpcLimitExceeded– Ifmax_pending_rpcscapacity is full.TimeoutError– Ifrequest_timeoutexpires; its pending aliases and quick-ACK registrations are removed.AmbiguousRpcResult– If an unsafe request loses transport after it may have reached Telegram.TransportError– If connection/recovery exhausts or protocol handling fails.CancelledError– If the caller cancels; its pending state is removed without cancelling other requests.
Notes
Calls may run concurrently. Sending and message ID allocation are serialized internally, while futures resolve independently.