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
- __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:
- 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:
- __weakref__
list of weak references to the object
- class pamqp.base.BasicProperties[source]
Provide a base object that marshals and unmarshals the Basic.Properties object values.
- 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:
name – The name of the property to encode
value (
pamqp.common.FieldValue
) – The property to encode
- 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
- __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:
- 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:
- __weakref__
list of weak references to the object