Skip to content

Examples#

Index > IoTDataPlane > Examples

Auto-generated documentation for IoTDataPlane type annotations stubs module types-boto3-iot-data.

Client#

Implicit type annotations#

Can be used with types-boto3[iot-data] package installed.

Write your IoTDataPlane code as usual, type checking and code completion should work out of the box.

# IoTDataPlaneClient usage example

from boto3.session import Session


session = Session()

client = session.client("iot-data")  # (1)
result = client.delete_thing_shadow()  # (2)
  1. client: IoTDataPlaneClient
  2. result: DeleteThingShadowResponseTypeDef
# ListRetainedMessagesPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("iot-data")  # (1)

paginator = client.get_paginator("list_retained_messages")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: IoTDataPlaneClient
  2. paginator: ListRetainedMessagesPaginator
  3. item: ListRetainedMessagesResponseTypeDef

Explicit type annotations#

With types-boto3-lite[iot-data] or a standalone types_boto3_iot_data package, you have to explicitly specify client: IoTDataPlaneClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# IoTDataPlaneClient usage example with type annotations

from boto3.session import Session

from types_boto3_iot_data.client import IoTDataPlaneClient
from types_boto3_iot_data.type_defs import DeleteThingShadowResponseTypeDef
from types_boto3_iot_data.type_defs import DeleteThingShadowRequestRequestTypeDef


session = Session()

client: IoTDataPlaneClient = session.client("iot-data")

kwargs: DeleteThingShadowRequestRequestTypeDef = {...}
result: DeleteThingShadowResponseTypeDef = client.delete_thing_shadow(**kwargs)
# ListRetainedMessagesPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_iot_data.client import IoTDataPlaneClient
from types_boto3_iot_data.paginator import ListRetainedMessagesPaginator
from types_boto3_iot_data.type_defs import ListRetainedMessagesResponseTypeDef


session = Session()
client: IoTDataPlaneClient = session.client("iot-data")

paginator: ListRetainedMessagesPaginator = client.get_paginator("list_retained_messages")
for item in paginator.paginate(...):
    item: ListRetainedMessagesResponseTypeDef
    print(item)