mypy-boto3-snow-device-management

1.42.3 · active · verified Sat Apr 11

This library provides type annotations (stubs) for the `boto3` AWS Snow Device Management service, generated by `mypy-boto3-builder`. It enhances type checking for `boto3` code with tools like `mypy`, preventing common runtime errors related to incorrect AWS API calls. The current version is 1.42.3, with releases closely following `boto3` updates and the `mypy-boto3-builder`'s frequent development cycle.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a `boto3` client and use the `mypy-boto3-snow-device-management` type stubs to add type annotations. This allows `mypy` to verify method calls and response structures at static analysis time, catching potential errors before runtime. Remember to replace 'your-device-id-placeholder' with an actual device ID or set the `AWS_SNOW_DEVICE_ID` environment variable for a successful API call.

import boto3
from mypy_boto3_snow_device_management.client import SnowDeviceManagementClient
from mypy_boto3_snow_device_management.type_defs import DescribeDeviceOutputTypeDef
import os

# Create a boto3 client (runtime object)
# Mypy will now correctly type-check operations on 'client'
client: SnowDeviceManagementClient = boto3.client("snow-device-management")

# Example usage with type hints
device_id = os.environ.get('AWS_SNOW_DEVICE_ID', 'your-device-id-placeholder')

if device_id == 'your-device-id-placeholder':
    print("Please set the AWS_SNOW_DEVICE_ID environment variable for a real test.")
    print("Using a placeholder, type checking will still work.")

try:
    response: DescribeDeviceOutputTypeDef = client.describe_device(deviceId=device_id)
    print(f"Device ARN: {response.get('deviceArn')}")
    print(f"Device type: {response.get('deviceType')}")
    # Mypy would warn if 'deviceArn' was not a valid key in DescribeDeviceOutputTypeDef
except client.exceptions.ResourceNotFoundException:
    print(f"Device with ID '{device_id}' not found.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →