awsiot

class awsiot.MqttServiceClient(mqtt_connection)

Bases: object

Base class for an AWS MQTT Service Client

Parameters:

mqtt_connection (Connection) – MQTT connection to use

property mqtt_connection: Connection

MQTT connection used by this client

unsubscribe(topic)

Tell the MQTT server to stop sending messages to this topic.

Parameters:

topic (str) – Topic to unsubscribe from

Returns:

Future whose result will be None when the server has acknowledged the unsubscribe.

Return type:

Future

class awsiot.ModeledClass

Bases: object

Base for input/output classes generated from an AWS service model.

exception awsiot.V2ServiceException(message, inner_error, modeled_error)

Bases: Exception

Wrapper exception thrown by V2 service clients to indicate the failure of an operation

Parameters:
  • message (str) – Description of the failure.

  • inner_error (Optional[Exception]) – Cause of the failure.

  • modeled_error (Optional[Any]) – Modeled error shape that contains additional information about the failure. The modeled type is specific to each individual service operation.

exception awsiot.V2DeserializationFailure(message, inner_error, payload)

Bases: Exception

An exception raised when deserialization from an MQTT message payload to a modeled type fails

Parameters:
  • message (str) – description of the failure

  • inner_error (Optional[Exception]) – the underlying deserialization exception

  • payload (Optional[bytes]) – original MQTT message payload that could not be deserialized properly

class awsiot.ServiceStreamOptions(incoming_event_listener, subscription_status_listener=None, deserialization_failure_listener=None)

Bases: Generic[T]

Configuration options for an MQTT-based service streaming operation.

Parameters:
  • incoming_event_listener (Callable[[T], None]) – function object to invoke when a stream message is successfully deserialized

  • subscription_status_listener (Optional[Callable[[awscrt.mqtt_request_response.SubscriptionStatusEvent], None]]) – function object to invoke when the operation’s subscription status changes

  • deserialization_failure_listener (Optional[Callable[[V2DeserializationFailure], None]]) – function object to invoke when a publish is received on the streaming subscription that cannot be deserialized into the stream’s output type. Should never happen.