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) Union[bool, bytearray, decimal.Decimal, List[FieldValue], Dict[str, FieldValue], float, int, None, str, datetime.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, Union[bool, bytearray, decimal.Decimal, List[FieldValue], Dict[str, FieldValue], float, int, None, str, datetime.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 (if defined)
- 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.
- encode_property(name: str, value: Union[bool, bytearray, decimal.Decimal, List[FieldValue], Dict[str, FieldValue], float, int, None, str, datetime.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
- __contains__(item: str) bool
Return if the item is in the attribute list
- __getitem__(item: str) Union[bool, bytearray, decimal.Decimal, List[FieldValue], Dict[str, FieldValue], float, int, None, str, datetime.datetime]
Return an attribute as if it were a dict
- Parameters
item – The key to use to retrieve the value
- Return type
- Raises
KeyError
- __hash__ = None
- __iter__() Generator[Tuple[str, Union[bool, bytearray, decimal.Decimal, List[FieldValue], Dict[str, FieldValue], float, int, None, str, datetime.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 (if defined)
- 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