Examples#
Auto-generated documentation for WorkMail type annotations stubs module mypy-boto3-workmail.
Client#
Implicit type annotations#
Can be used with boto3-stubs[workmail]
package installed.
Write your WorkMail
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# WorkMailClient usage example
from boto3.session import Session
session = Session()
client = session.client("workmail") # (1)
result = client.assume_impersonation_role() # (2)
- client: WorkMailClient
- result: AssumeImpersonationRoleResponseTypeDef
Paginator usage example#
# ListAliasesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("workmail") # (1)
paginator = client.get_paginator("list_aliases") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: WorkMailClient
- paginator: ListAliasesPaginator
- item: ListAliasesResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[workmail]
or a standalone mypy_boto3_workmail
package, you have to explicitly specify client: WorkMailClient
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.
Client method usage example#
# WorkMailClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_workmail.client import WorkMailClient
from mypy_boto3_workmail.type_defs import AssumeImpersonationRoleResponseTypeDef
from mypy_boto3_workmail.type_defs import AssumeImpersonationRoleRequestTypeDef
session = Session()
client: WorkMailClient = session.client("workmail")
kwargs: AssumeImpersonationRoleRequestTypeDef = {...}
result: AssumeImpersonationRoleResponseTypeDef = client.assume_impersonation_role(**kwargs)
Paginator usage example#
# ListAliasesPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_workmail.client import WorkMailClient
from mypy_boto3_workmail.paginator import ListAliasesPaginator
from mypy_boto3_workmail.type_defs import ListAliasesResponseTypeDef
session = Session()
client: WorkMailClient = session.client("workmail")
paginator: ListAliasesPaginator = client.get_paginator("list_aliases")
for item in paginator.paginate(...):
item: ListAliasesResponseTypeDef
print(item)