mypy-boto3-connect-contact-lens type stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-connect-contact-lens provides type annotations for the boto3 Connect Contact Lens service, ensuring static type checking for your AWS interactions. It's automatically generated by `mypy-boto3-builder` and aims to keep parity with `boto3` releases, providing updated stubs frequently.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `ConnectContactLensClient` with type hints and use it. `mypy` will automatically pick up the stubs for `boto3.client`, but explicit imports for the client type and TypeDefs are shown for clarity and comprehensive type checking.

import boto3
from mypy_boto3_connect_contact_lens.client import ConnectContactLensClient
from mypy_boto3_connect_contact_lens.type_defs import ListRealtimeContactAnalysisSegmentsRequestRequestTypeDef
import os

# mypy will infer the type from boto3.client if stubs are installed
client: ConnectContactLensClient = boto3.client(
    "connect-contact-lens",
    aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),
    aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),
    region_name=os.environ.get('AWS_REGION', 'us-east-1')
)

def list_segments(client: ConnectContactLensClient):
    params: ListRealtimeContactAnalysisSegmentsRequestRequestTypeDef = {
        "InstanceId": "your-instance-id", # Replace with your Connect instance ID
        "ContactId": "your-contact-id" # Replace with a valid Contact ID
    }
    try:
        response = client.list_realtime_contact_analysis_segments(**params)
        print("Segments found:", response.get("Segments", []))
    except client.exceptions.ResourceNotFoundException:
        print("Instance or Contact not found. Please provide valid IDs.")
    except Exception as e:
        print(f"An error occurred: {e}")

# Example usage (requires valid AWS credentials and resource IDs for actual execution)
# list_segments(client)

view raw JSON →