Examples#
Index > IoTDataPlane > Examples
Auto-generated documentation for IoTDataPlane type annotations stubs module mypy-boto3-iot-data.
Client#
Implicit type annotations#
Can be used with boto3-stubs[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)
- client: IoTDataPlaneClient
- 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)
- client: IoTDataPlaneClient
- paginator: ListRetainedMessagesPaginator
- item: ListRetainedMessagesResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[iot-data]
or a standalone mypy_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 mypy_boto3_iot_data.client import IoTDataPlaneClient
from mypy_boto3_iot_data.type_defs import DeleteThingShadowResponseTypeDef
from mypy_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 mypy_boto3_iot_data.client import IoTDataPlaneClient
from mypy_boto3_iot_data.paginator import ListRetainedMessagesPaginator
from mypy_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)