{"id":3651,"library":"mypy-boto3-notificationscontacts","title":"mypy-boto3-notificationscontacts Type Stubs","description":"mypy-boto3-notificationscontacts provides type annotations for the `boto3` AWS UserNotificationsContacts service. It is part of the `mypy-boto3-builder` project, which frequently releases updates to keep pace with `boto3` and `botocore` releases, ensuring up-to-date and accurate type hints for AWS service clients. The current version is 1.42.3.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-stubs","notificationscontacts","typing"],"install":[{"cmd":"pip install mypy-boto3-notificationscontacts boto3","lang":"bash","label":"Install with boto3"}],"dependencies":[{"reason":"This library provides type stubs for boto3, so boto3 must be installed for runtime functionality.","package":"boto3"}],"imports":[{"symbol":"NotificationsContactsClient","correct":"from mypy_boto3_notificationscontacts.client import NotificationsContactsClient"},{"note":"Not all boto3 services have a 'ServiceResource'; this is specific to those that do. Use Client for most operations.","symbol":"NotificationsContactsServiceResource","correct":"from mypy_boto3_notificationscontacts.service_resource import NotificationsContactsServiceResource"},{"note":"Import specific TypeDefs for precise typing of request and response dictionaries.","symbol":"ContactChannelTypeDef","correct":"from mypy_boto3_notificationscontacts.type_defs import ContactChannelTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nimport os\n\n# Ensure boto3 is installed: pip install boto3\n# Ensure stubs are installed: pip install mypy-boto3-notificationscontacts\n\nif TYPE_CHECKING:\n    from mypy_boto3_notificationscontacts.client import NotificationsContactsClient\n    from mypy_boto3_notificationscontacts.type_defs import ListContactChannelsResponseTypeDef\n\ndef get_notifications_contacts_client() -> \"NotificationsContactsClient\":\n    # Use environment variables for credentials in production\n    # Example: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME\n    return boto3.client(\n        \"notifications-contacts\",\n        region_name=os.environ.get('AWS_REGION', 'us-east-1')\n    )\n\nclient = get_notifications_contacts_client()\n\ntry:\n    # Example: Listing contact channels\n    response: ListContactChannelsResponseTypeDef = client.list_contact_channels()\n    print(\"Successfully listed contact channels:\")\n    for channel in response.get(\"ContactChannels\", []):\n        print(f\"  - Channel ID: {channel.get('ChannelId')}, Type: {channel.get('ChannelType')}\")\nexcept client.exceptions.ClientError as e:\n    print(f\"Error calling list_contact_channels: {e}\")\n    if e.response.get('Error', {}).get('Code') == 'AccessDeniedException':\n        print(\"Check your AWS credentials and IAM permissions for NotificationsContacts.\")\n\n# Example: Creating a contact (requires specific parameters and permissions)\n# try:\n#     create_contact_response = client.create_contact(\n#         ContactAlias=\"my-contact\",\n#         DisplayName=\"My Contact\",\n#         Type=\"PERSONAL\", # or 'STANDARD'\n#         # 'Plan': {'Stage': [{'StageName': 'Default', 'DurationInMinutes': 5, 'Targets': [...]}]}\n#     )\n#     print(f\"Created contact: {create_contact_response.get('ContactArn')}\")\n# except client.exceptions.ClientError as e:\n#     print(f\"Error creating contact: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` client for the UserNotificationsContacts service and type it using `mypy-boto3-notificationscontacts`. It includes a basic interaction (listing contact channels) and error handling, emphasizing the need for both `boto3` and the type stubs, and proper AWS credentials."},"warnings":[{"fix":"Upgrade your project's Python version to 3.9 or higher.","message":"Starting with `mypy-boto3-builder` version 8.12.0 (which generates these stubs), Python 3.8 is no longer supported. Ensure your project uses Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0, mypy-boto3-notificationscontacts >= 1.42.3"},{"fix":"Ensure you are using a recent version of `mypy`. If issues persist, verify `mypy`'s `follow_imports` settings or refer to `mypy` and `mypy-boto3` documentation.","message":"The `mypy-boto3-builder` project migrated to PEP 561 compliant packages (with `py.typed` markers) in version 8.12.0. While this generally improves type checker integration, older `mypy` versions or custom `mypy` configurations might need adjustments if stubs are not being picked up correctly.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0, mypy-boto3-notificationscontacts >= 1.42.3"},{"fix":"Always include `boto3` in your project's runtime dependencies (e.g., `requirements.txt`).","message":"This package provides *only* type stubs. You must explicitly install `boto3` (e.g., `pip install boto3`) for your code to run at runtime. These stubs are for static analysis by tools like `mypy`.","severity":"gotcha","affected_versions":"All"},{"fix":"Install `mypy-boto3` (for all services) or additional `mypy-boto3-SERVICE_NAME` packages for other services you use.","message":"This specific package (`mypy-boto3-notificationscontacts`) provides type stubs for the AWS UserNotificationsContacts service only. If you need type stubs for multiple or all `boto3` services, consider installing the `mypy-boto3` meta-package or individual service stubs as needed to avoid potential conflicts or missing types.","severity":"gotcha","affected_versions":"All"},{"fix":"Consult the `mypy-boto3-builder` release notes and `boto3` documentation for the latest service names and APIs. Update your code and package dependencies accordingly.","message":"AWS services can be deprecated, renamed, or replaced, which will be reflected in `mypy-boto3` packages. For example, `sms-voice` was removed in `builder` 8.11.0, replaced by `pinpoint-sms-voice`. Always check the `mypy-boto3-builder` release notes for changes affecting service availability or naming.","severity":"deprecated","affected_versions":"mypy-boto3-builder >= 8.11.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}