{"id":3350,"library":"mypy-boto3-connect-contact-lens","title":"mypy-boto3-connect-contact-lens type stubs","description":"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.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","mypy","typing","stubs","type-hints","connect-contact-lens"],"install":[{"cmd":"pip install mypy-boto3-connect-contact-lens","lang":"bash","label":"Install service stubs"}],"dependencies":[{"reason":"These are type stubs for the boto3 library; boto3 itself must be installed to run code using these stubs.","package":"boto3","optional":false}],"imports":[{"note":"While mypy automatically uses the stubs for `boto3.client('connect-contact-lens')`, explicitly importing the client type allows for clearer annotations.","symbol":"ConnectContactLensClient","correct":"from mypy_boto3_connect_contact_lens.client import ConnectContactLensClient"},{"symbol":"Service Resource, Paginator, Waiter types","correct":"from mypy_boto3_connect_contact_lens import ConnectContactLensClient, ConnectContactLensServiceResource, Paginator, Waiter"},{"symbol":"TypeDefs","correct":"from mypy_boto3_connect_contact_lens.type_defs import ListRealtimeContactAnalysisSegmentsRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_connect_contact_lens.client import ConnectContactLensClient\nfrom mypy_boto3_connect_contact_lens.type_defs import ListRealtimeContactAnalysisSegmentsRequestRequestTypeDef\nimport os\n\n# mypy will infer the type from boto3.client if stubs are installed\nclient: ConnectContactLensClient = boto3.client(\n    \"connect-contact-lens\",\n    aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),\n    aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),\n    region_name=os.environ.get('AWS_REGION', 'us-east-1')\n)\n\ndef list_segments(client: ConnectContactLensClient):\n    params: ListRealtimeContactAnalysisSegmentsRequestRequestTypeDef = {\n        \"InstanceId\": \"your-instance-id\", # Replace with your Connect instance ID\n        \"ContactId\": \"your-contact-id\" # Replace with a valid Contact ID\n    }\n    try:\n        response = client.list_realtime_contact_analysis_segments(**params)\n        print(\"Segments found:\", response.get(\"Segments\", []))\n    except client.exceptions.ResourceNotFoundException:\n        print(\"Instance or Contact not found. Please provide valid IDs.\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\n# Example usage (requires valid AWS credentials and resource IDs for actual execution)\n# list_segments(client)","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later. If you need Python 3.8, you must use older versions of `mypy-boto3` stubs and the builder.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0 (which generates these stubs). Projects using this library now require Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0, mypy-boto3-* corresponding versions"},{"fix":"Update direct imports of affected TypeDefs in your code to use the new naming conventions. Consult the `mypy-boto3-builder` changelog for specific changes if migrating from older versions.","message":"Several TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Specifically, argument TypeDefs were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) and conflicting `Extra` postfixes moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0, mypy-boto3-* corresponding versions"},{"fix":"Regularly update both `boto3` and its corresponding `mypy-boto3-*` stub packages. For example, if you have `boto3==1.28.0`, install `mypy-boto3==1.28.0` and `mypy-boto3-connect-contact-lens==1.28.0`.","message":"mypy-boto3 stubs are designed to match specific `boto3` versions. To ensure correct type checking, you should always keep your `mypy-boto3-*` packages in sync with your installed `boto3` version.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For basic client use, rely on `mypy`'s automatic stub discovery. For detailed type annotations involving `TypeDef`s or explicit client type declarations, import the specific types directly from the `mypy_boto3_service_name` package.","message":"When using `boto3.client('service-name')`, `mypy` will automatically pick up the installed type stubs, so explicit `from mypy_boto3_service_name.client import ServiceClient` imports are not strictly required for basic client usage. However, for accessing specific `TypeDef` classes or for clearer function signatures, explicit imports are still necessary.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}