pamqp.base

Base classes for the representation of frames and data structures.

class pamqp.base.Frame[source]

Base Class for AMQ Methods for encoding and decoding

marshal()[source]

Dynamically encode the frame by taking the list of attributes and encode them item by item getting the value form the object attribute and the data type from the class attribute.

Return type

bytes

unmarshal(data)[source]

Dynamically decode the frame data applying the values to the method object by iterating through the attributes in order and decoding them.

Parameters

data (bytes) – The raw AMQP frame data

Return type

None

validate()[source]

Validate the frame data ensuring all domains or attributes adhere to the protocol specification.

Raises

ValueError

Return type

None

__contains__(item)

Return if the item is in the attribute list

Parameters

item (str) –

Return type

bool

__eq__()

Return self==value.

__getitem__(item)

Return an attribute as if it were a dict

Parameters

item (str) – The key to use to retrieve the value

Return type

pamqp.common.FieldValue

Raises

KeyError

__iter__()

Iterate the attributes and values as key, value pairs

Return type

(str, pamqp.common.FieldValue)

__len__()

Return the length of the attribute list

Return type

int

classmethod amqp_type(attr)

Return the AMQP data type for an attribute

Parameters

attr (str) – The attribute name

Return type

str

classmethod attributes()

Return the list of attributes

Return type

list

class pamqp.base.BasicProperties[source]

Provide a base object that marshals and unmarshals the Basic.Properties object values.

__eq__(other)[source]

Return self==value.

Parameters

other (object) –

Return type

bool

encode_property(name, value)[source]

Encode a single property value

Parameters
Raises

TypeError

Return type

bytes

marshal()[source]

Take the Basic.Properties data structure and marshal it into the data structure needed for the ContentHeader.

Return type

bytes

unmarshal(flags, data)[source]

Dynamically decode the frame data applying the values to the method object by iterating through the attributes in order and decoding them.

Parameters
Return type

None

validate()[source]

Validate the frame data ensuring all domains or attributes adhere to the protocol specification.

Raises

ValueError

Return type

None

__contains__(item)

Return if the item is in the attribute list

Parameters

item (str) –

Return type

bool

__getitem__(item)

Return an attribute as if it were a dict

Parameters

item (str) – The key to use to retrieve the value

Return type

pamqp.common.FieldValue

Raises

KeyError

__iter__()

Iterate the attributes and values as key, value pairs

Return type

(str, pamqp.common.FieldValue)

__len__()

Return the length of the attribute list

Return type

int

classmethod amqp_type(attr)

Return the AMQP data type for an attribute

Parameters

attr (str) – The attribute name

Return type

str

classmethod attributes()

Return the list of attributes

Return type

list