Examples#
Auto-generated documentation for WorkMail type annotations stubs module types-boto3-workmail.
Client#
Implicit type annotations#
Can be used with types-boto3[workmail]
package installed.
Write your WorkMail
code as usual,
type checking and code completion should work out of the box.
# 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
# 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 types-boto3-lite[workmail]
or a standalone types_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.
# WorkMailClient usage example with type annotations
from boto3.session import Session
from types_boto3_workmail.client import WorkMailClient
from types_boto3_workmail.type_defs import AssumeImpersonationRoleResponseTypeDef
from types_boto3_workmail.type_defs import AssumeImpersonationRoleRequestRequestTypeDef
session = Session()
client: WorkMailClient = session.client("workmail")
kwargs: AssumeImpersonationRoleRequestRequestTypeDef = {...}
result: AssumeImpersonationRoleResponseTypeDef = client.assume_impersonation_role(**kwargs)
# ListAliasesPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_workmail.client import WorkMailClient
from types_boto3_workmail.paginator import ListAliasesPaginator
from types_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)