Table of Contents
A low-level client representing AWS IoT Data Plane:
client = session.create_client('iot-data')
These are the available methods:
Check if an operation can be paginated.
Deletes the thing shadow for the specified thing.
For more information, see DeleteThingShadow in the AWS IoT Developer Guide .
See also: AWS API Documentation
Request Syntax
response = client.delete_thing_shadow(
thingName='string'
)
[REQUIRED]
The name of the thing.
{
'payload': StreamingBody()
}
Response Structure
The output from the DeleteThingShadow operation.
The state information, in JSON format.
Exceptions
Generate a presigned url given a client, its method, and arguments
The presigned url
Create a paginator for an operation.
Gets the thing shadow for the specified thing.
For more information, see GetThingShadow in the AWS IoT Developer Guide .
See also: AWS API Documentation
Request Syntax
response = client.get_thing_shadow(
thingName='string'
)
[REQUIRED]
The name of the thing.
{
'payload': StreamingBody()
}
Response Structure
The output from the GetThingShadow operation.
The state information, in JSON format.
Exceptions
Returns an object that can wait for some condition.
Publishes state information.
For more information, see HTTP Protocol in the AWS IoT Developer Guide .
See also: AWS API Documentation
Request Syntax
response = client.publish(
topic='string',
qos=123,
payload=b'bytes'|file
)
[REQUIRED]
The name of the MQTT topic.
None
Exceptions
Updates the thing shadow for the specified thing.
For more information, see UpdateThingShadow in the AWS IoT Developer Guide .
See also: AWS API Documentation
Request Syntax
response = client.update_thing_shadow(
thingName='string',
payload=b'bytes'|file
)
[REQUIRED]
The name of the thing.
[REQUIRED]
The state information, in JSON format.
dict
Response Syntax
{
'payload': StreamingBody()
}
Response Structure
(dict) --
The output from the UpdateThingShadow operation.
payload (StreamingBody) --
The state information, in JSON format.
Exceptions
Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.
The available client exceptions are:
The specified version does not match the version of the document.
Example
try:
...
except client.exceptions.ConflictException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The specified version does not match the version of the document.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
An unexpected error has occurred.
Example
try:
...
except client.exceptions.InternalFailureException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
An unexpected error has occurred.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
The request is not valid.
Example
try:
...
except client.exceptions.InvalidRequestException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The request is not valid.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
The specified combination of HTTP verb and URI is not supported.
Example
try:
...
except client.exceptions.MethodNotAllowedException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The specified combination of HTTP verb and URI is not supported.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
The payload exceeds the maximum size allowed.
Example
try:
...
except client.exceptions.RequestEntityTooLargeException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The payload exceeds the maximum size allowed.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
The specified resource does not exist.
Example
try:
...
except client.exceptions.ResourceNotFoundException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The specified resource does not exist.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
The service is temporarily unavailable.
Example
try:
...
except client.exceptions.ServiceUnavailableException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The service is temporarily unavailable.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
The rate exceeds the limit.
Example
try:
...
except client.exceptions.ThrottlingException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The rate exceeds the limit.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
You are not authorized to perform this operation.
Example
try:
...
except client.exceptions.UnauthorizedException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
You are not authorized to perform this operation.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.
The document encoding is not supported.
Example
try:
...
except client.exceptions.UnsupportedDocumentEncodingException as e:
print(e.response)
The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.
Syntax
{
'message': 'string',
'Error': {
'Code': 'string',
'Message': 'string'
}
}
Structure
(dict) --
The document encoding is not supported.
message (string) --
The message for the exception.
Error (dict) -- Normalized access to common exception attributes.