mypy-boto3-iotsitewise Type Stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-iotsitewise provides PEP 561 compliant type annotations for the AWS boto3 IoTSiteWise service, generated by the mypy-boto3-builder. It enhances type checking for `boto3.client('iotsitewise')` calls, enabling robust static analysis with tools like mypy and pyright, and improving IDE auto-completion. This library is actively maintained, with versions closely synchronized with upstream boto3 releases.

Warnings

Install

Imports

Quickstart

This example demonstrates how to obtain a type-hinted IoTSiteWise client using `boto3` and `mypy-boto3-iotsitewise` for improved static analysis. It includes placeholder credential handling for a runnable example.

import boto3
from mypy_boto3_iotsitewise.client import IoTSiteWiseClient

def get_iotsitewise_client() -> IoTSiteWiseClient:
    """Get a type-hinted AWS IoT SiteWise client."""
    # Ensure AWS credentials are set up (e.g., via environment variables or ~/.aws/credentials)
    client: IoTSiteWiseClient = boto3.client(
        "iotsitewise",
        region_name="us-east-1", # Replace with your desired region
        aws_access_key_id='YOUR_ACCESS_KEY' or os.environ.get('AWS_ACCESS_KEY_ID', ''),
        aws_secret_access_key='YOUR_SECRET_KEY' or os.environ.get('AWS_SECRET_ACCESS_KEY', ''),
        aws_session_token='YOUR_SESSION_TOKEN' or os.environ.get('AWS_SESSION_TOKEN', '')
    )
    return client

if __name__ == "__main__":
    # Example usage: list assets (requires appropriate permissions)
    try:
        iotsitewise_client = get_iotsitewise_client()
        response = iotsitewise_client.list_assets(maxResults=5)
        print("Successfully retrieved IoT SiteWise assets:")
        for asset in response.get("assetSummaries", []):
            print(f"  - {asset['name']} (ID: {asset['id']})")
    except Exception as e:
        print(f"Error interacting with IoT SiteWise: {e}")

view raw JSON →