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() bytes[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.

unmarshal(data: bytes) None[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 – The raw AMQP frame data

validate() None[source]

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

Raises:

ValueError

__contains__(item: str) bool

Return if the item is in the attribute list

__getitem__(item: str) bool | bytes | bytearray | Decimal | List[FieldValue] | Dict[str, FieldValue] | float | int | None | str | datetime

Return an attribute as if it were a dict

Parameters:

item – The key to use to retrieve the value

Return type:

pamqp.common.FieldValue

Raises:

KeyError

__iter__() Generator[Tuple[str, bool | bytes | bytearray | Decimal | List[FieldValue] | Dict[str, FieldValue] | float | int | None | str | datetime], None, None]

Iterate the attributes and values as key, value pairs

Return type:

(str, pamqp.common.FieldValue)

__len__() int

Return the length of the attribute list

__repr__() str

Return the representation of the frame object

__weakref__

list of weak references to the object

classmethod amqp_type(attr: str) str

Return the AMQP data type for an attribute

Parameters:

attr – The attribute name

classmethod attributes() list

Return the list of attributes

class pamqp.base.BasicProperties[source]

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

__eq__(other: object) bool[source]

Return self==value.

encode_property(name: str, value: bool | bytes | bytearray | Decimal | List[FieldValue] | Dict[str, FieldValue] | float | int | None | str | datetime) bytes[source]

Encode a single property value

Parameters:
Raises:

TypeError

marshal() bytes[source]

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

unmarshal(flags: int, data: bytes) None[source]

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

validate() None[source]

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

Raises:

ValueError

__contains__(item: str) bool

Return if the item is in the attribute list

__getitem__(item: str) bool | bytes | bytearray | Decimal | List[FieldValue] | Dict[str, FieldValue] | float | int | None | str | datetime

Return an attribute as if it were a dict

Parameters:

item – The key to use to retrieve the value

Return type:

pamqp.common.FieldValue

Raises:

KeyError

__iter__() Generator[Tuple[str, bool | bytes | bytearray | Decimal | List[FieldValue] | Dict[str, FieldValue] | float | int | None | str | datetime], None, None]

Iterate the attributes and values as key, value pairs

Return type:

(str, pamqp.common.FieldValue)

__len__() int

Return the length of the attribute list

__repr__() str

Return the representation of the frame object

__weakref__

list of weak references to the object

classmethod amqp_type(attr: str) str

Return the AMQP data type for an attribute

Parameters:

attr – The attribute name

classmethod attributes() list

Return the list of attributes