pamqp.decode

AMQP Data Decoder

Functions for decoding data of various types including field tables and arrays

pamqp.decode.bit(value, position)[source]

Decode a bit value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, bool value
Raises:ValueError
pamqp.decode.boolean(value)[source]

Decode a boolean value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, bool
Raises:ValueError
pamqp.decode.by_type(value, data_type, offset=0)[source]

Decodes values using the specified type

Parameters:
  • value (bytes) – Value to decode
  • data_type (str) – type of data to decode
Return tuple:

bytes consumed, mixed based on field type

pamqp.decode.byte_array(value)[source]

Decode a byte_array value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, bool
Raises:ValueError
pamqp.decode.decimal(value)[source]

Decode a decimal value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, decimal.Decimal value
Raises:ValueError
pamqp.decode.double(value)[source]

Decode a double value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, float
Raises:ValueError
pamqp.decode.field_array(value)[source]

Decode a field array value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, list
Raises:ValueError
pamqp.decode.field_table(value)[source]

Decode a field array value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, dict
Raises:ValueError
pamqp.decode.floating_point(value)[source]

Decode a floating point value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, float
Raises:ValueError
pamqp.decode.long_int(value)[source]

Decode a long integer value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, int
Raises:ValueError
pamqp.decode.long_long_int(value)[source]

Decode a long-long integer value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, int
Raises:ValueError
pamqp.decode.long_str(value)[source]

Decode a string value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, bytes|str
Raises:ValueError
pamqp.decode.octet(value)[source]

Decode an octet value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, int
Raises:ValueError
pamqp.decode.short_int(value)[source]

Decode a short integer value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, int
Raises:ValueError
pamqp.decode.short_short_int(value)[source]

Decode a short, short integer value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, int
Raises:ValueError
pamqp.decode.short_str(value)[source]

Decode a string value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, unicode|str
Raises:ValueError
pamqp.decode.timestamp(value)[source]

Decode a timestamp value

Parameters:value (bytes) – Value to decode
Return tuple:bytes used, struct_time
Raises:ValueError