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
-
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
-
__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
- Raises
KeyError
-
__iter__
()¶ Iterate the attributes and values as key, value pairs
- Return type
- classmethod
amqp_type
(attr)¶ Return the AMQP data type for an attribute
-
- class
pamqp.base.
BasicProperties
[source]¶ Provide a base object that marshals and unmarshals the Basic.Properties object values.
-
encode_property
(name, value)[source]¶ Encode a single property value
- Parameters
name (
str
) – The name of the property to encodevalue (
pamqp.common.FieldValue
) – The property to encode
- Raises
TypeError
- Return type
-
marshal
()[source]¶ Take the Basic.Properties data structure and marshal it into the data structure needed for the ContentHeader.
- Return type
-
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.
-
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
-
__getitem__
(item)¶ Return an attribute as if it were a dict
- Parameters
item (
str
) – The key to use to retrieve the value- Return type
- Raises
KeyError
-
__iter__
()¶ Iterate the attributes and values as key, value pairs
- Return type
- classmethod
amqp_type
(attr)¶ Return the AMQP data type for an attribute
-