Skip to content

Examples#

Index > SSMContacts > Examples

Auto-generated documentation for SSMContacts type annotations stubs module mypy-boto3-ssm-contacts.

Client#

Implicit type annotations#

Can be used with boto3-stubs[ssm-contacts] package installed.

Write your SSMContacts code as usual, type checking and code completion should work out of the box.

# SSMContactsClient usage example

from boto3.session import Session


session = Session()

client = session.client("ssm-contacts")  # (1)
result = client.create_contact()  # (2)
  1. client: SSMContactsClient
  2. result: CreateContactResultTypeDef
# ListContactChannelsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("ssm-contacts")  # (1)

paginator = client.get_paginator("list_contact_channels")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SSMContactsClient
  2. paginator: ListContactChannelsPaginator
  3. item: ListContactChannelsResultTypeDef

Explicit type annotations#

With boto3-stubs-lite[ssm-contacts] or a standalone mypy_boto3_ssm_contacts package, you have to explicitly specify client: SSMContactsClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# SSMContactsClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_ssm_contacts.client import SSMContactsClient
from mypy_boto3_ssm_contacts.type_defs import CreateContactResultTypeDef
from mypy_boto3_ssm_contacts.type_defs import CreateContactRequestRequestTypeDef


session = Session()

client: SSMContactsClient = session.client("ssm-contacts")

kwargs: CreateContactRequestRequestTypeDef = {...}
result: CreateContactResultTypeDef = client.create_contact(**kwargs)
# ListContactChannelsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_ssm_contacts.client import SSMContactsClient
from mypy_boto3_ssm_contacts.paginator import ListContactChannelsPaginator
from mypy_boto3_ssm_contacts.type_defs import ListContactChannelsResultTypeDef


session = Session()
client: SSMContactsClient = session.client("ssm-contacts")

paginator: ListContactChannelsPaginator = client.get_paginator("list_contact_channels")
for item in paginator.paginate(...):
    item: ListContactChannelsResultTypeDef
    print(item)