Examples#
Auto-generated documentation for IoT type annotations stubs module mypy-boto3-iot.
Client#
Implicit type annotations#
Can be used with boto3-stubs[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)
- client: IoTClient
- 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)
- client: IoTClient
- paginator: GetBehaviorModelTrainingSummariesPaginator
- item: GetBehaviorModelTrainingSummariesResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[iot]
or a standalone mypy_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 mypy_boto3_iot.client import IoTClient
from mypy_boto3_iot.type_defs import EmptyResponseMetadataTypeDef
from mypy_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 mypy_boto3_iot.client import IoTClient
from mypy_boto3_iot.paginator import GetBehaviorModelTrainingSummariesPaginator
from mypy_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)