Skip to content

miniproto.connection.framing.PythonFrameCodec.encode_packet

miniproto.connection.framing.PythonFrameCodec.encode_packet

Section titled “miniproto.connection.framing.PythonFrameCodec.encode_packet”
encode_packet(payload: bytes, *, quick_ack: bool = False) -> bytes

Return one complete framed packet.

Parameters:

  • payload (bytes) – Unframed MTProto packet bytes, bounded by the configured maximum.
  • quick_ack (bool) – Set the protocol quick-ACK-request bit where the chosen transport mode permits it.

Returns:

  • bytes – Wire-ready framing bytes. Padded intermediate frames include zero to
  • bytes – fifteen random transport-padding bytes.

Raises:

  • TransportError – If the payload is oversized or violates the mode’s alignment or encoding limits.