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) -> bytesReturn 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 tobytes– fifteen random transport-padding bytes.
Raises:
TransportError– If the payload is oversized or violates the mode’s alignment or encoding limits.