Skip to content

Examples#

Index > SES > Examples

Auto-generated documentation for SES type annotations stubs module types-boto3-ses.

Client#

Implicit type annotations#

Can be used with types-boto3[ses] package installed.

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

# SESClient usage example

from boto3.session import Session


session = Session()

client = session.client("ses")  # (1)
result = client.create_custom_verification_email_template()  # (2)
  1. client: SESClient
  2. result: EmptyResponseMetadataTypeDef
# ListConfigurationSetsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("ses")  # (1)

paginator = client.get_paginator("list_configuration_sets")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: SESClient
  2. paginator: ListConfigurationSetsPaginator
  3. item: ListConfigurationSetsResponseTypeDef
# IdentityExistsWaiter usage example

from boto3.session import Session


session = Session()
client = session.client("ses")  # (1)

waiter = client.get_waiter("identity_exists")  # (2)
waiter.wait()
  1. client: SESClient
  2. waiter: IdentityExistsWaiter

Explicit type annotations#

With types-boto3-lite[ses] or a standalone types_boto3_ses package, you have to explicitly specify client: SESClient 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.

# SESClient usage example with type annotations

from boto3.session import Session

from types_boto3_ses.client import SESClient
from types_boto3_ses.type_defs import EmptyResponseMetadataTypeDef
from types_boto3_ses.type_defs import CreateCustomVerificationEmailTemplateRequestRequestTypeDef


session = Session()

client: SESClient = session.client("ses")

kwargs: CreateCustomVerificationEmailTemplateRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.create_custom_verification_email_template(**kwargs)
# ListConfigurationSetsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_ses.client import SESClient
from types_boto3_ses.paginator import ListConfigurationSetsPaginator
from types_boto3_ses.type_defs import ListConfigurationSetsResponseTypeDef


session = Session()
client: SESClient = session.client("ses")

paginator: ListConfigurationSetsPaginator = client.get_paginator("list_configuration_sets")
for item in paginator.paginate(...):
    item: ListConfigurationSetsResponseTypeDef
    print(item)
# IdentityExistsWaiter usage example with type annotations

from boto3.session import Session

from types_boto3_ses.client import SESClient
from types_boto3_ses.waiter import IdentityExistsWaiter

session = Session()
client: SESClient = session.client("ses")

waiter: IdentityExistsWaiter = client.get_waiter("identity_exists")
waiter.wait()