Skip to content

Examples#

Index > IoT > Examples

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

Client#

Implicit type annotations#

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

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

# IoTClient usage example

from boto3.session import Session


session = Session()

client = session.client("iot")  # (1)
result = client.accept_certificate_transfer()  # (2)
  1. client: IoTClient
  2. result: EmptyResponseMetadataTypeDef
# GetBehaviorModelTrainingSummariesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("get_behavior_model_training_summaries")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: IoTClient
  2. paginator: GetBehaviorModelTrainingSummariesPaginator
  3. item: GetBehaviorModelTrainingSummariesResponseTypeDef

Explicit type annotations#

With types-boto3-lite[iot] or a standalone types_boto3_iot package, you have to explicitly specify client: IoTClient 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.

# IoTClient usage example with type annotations

from boto3.session import Session

from types_boto3_iot.client import IoTClient
from types_boto3_iot.type_defs import EmptyResponseMetadataTypeDef
from types_boto3_iot.type_defs import AcceptCertificateTransferRequestRequestTypeDef


session = Session()

client: IoTClient = session.client("iot")

kwargs: AcceptCertificateTransferRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.accept_certificate_transfer(**kwargs)
# GetBehaviorModelTrainingSummariesPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_iot.client import IoTClient
from types_boto3_iot.paginator import GetBehaviorModelTrainingSummariesPaginator
from types_boto3_iot.type_defs import GetBehaviorModelTrainingSummariesResponseTypeDef


session = Session()
client: IoTClient = session.client("iot")

paginator: GetBehaviorModelTrainingSummariesPaginator = client.get_paginator("get_behavior_model_training_summaries")
for item in paginator.paginate(...):
    item: GetBehaviorModelTrainingSummariesResponseTypeDef
    print(item)