Skip to content

Examples#

Index > IoTSiteWise > Examples

Auto-generated documentation for IoTSiteWise type annotations stubs module mypy-boto3-iotsitewise.

Client#

Implicit type annotations#

Can be used with boto3-stubs[iotsitewise] package installed.

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

# IoTSiteWiseClient usage example

from boto3.session import Session


session = Session()

client = session.client("iotsitewise")  # (1)
result = client.associate_assets()  # (2)
  1. client: IoTSiteWiseClient
  2. result: EmptyResponseMetadataTypeDef
# ExecuteQueryPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("execute_query")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: IoTSiteWiseClient
  2. paginator: ExecuteQueryPaginator
  3. item: ExecuteQueryResponseTypeDef
# AssetActiveWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("asset_active")  # (2)
waiter.wait()
  1. client: IoTSiteWiseClient
  2. waiter: AssetActiveWaiter

Explicit type annotations#

With boto3-stubs-lite[iotsitewise] or a standalone mypy_boto3_iotsitewise package, you have to explicitly specify client: IoTSiteWiseClient 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.

# IoTSiteWiseClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_iotsitewise.client import IoTSiteWiseClient
from mypy_boto3_iotsitewise.type_defs import EmptyResponseMetadataTypeDef
from mypy_boto3_iotsitewise.type_defs import AssociateAssetsRequestRequestTypeDef


session = Session()

client: IoTSiteWiseClient = session.client("iotsitewise")

kwargs: AssociateAssetsRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.associate_assets(**kwargs)
# ExecuteQueryPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_iotsitewise.client import IoTSiteWiseClient
from mypy_boto3_iotsitewise.paginator import ExecuteQueryPaginator
from mypy_boto3_iotsitewise.type_defs import ExecuteQueryResponseTypeDef


session = Session()
client: IoTSiteWiseClient = session.client("iotsitewise")

paginator: ExecuteQueryPaginator = client.get_paginator("execute_query")
for item in paginator.paginate(...):
    item: ExecuteQueryResponseTypeDef
    print(item)
# AssetActiveWaiter usage example with type annotations

from boto3.session import Session

from mypy_boto3_iotsitewise.client import IoTSiteWiseClient
from mypy_boto3_iotsitewise.waiter import AssetActiveWaiter

session = Session()
client: IoTSiteWiseClient = session.client("iotsitewise")

waiter: AssetActiveWaiter = client.get_waiter("asset_active")
waiter.wait()