Examples#
Index > WorkSpaces > Examples
Auto-generated documentation for WorkSpaces type annotations stubs module mypy-boto3-workspaces.
Client#
Implicit type annotations#
Can be used with boto3-stubs[workspaces]
package installed.
Write your WorkSpaces
code as usual,
type checking and code completion should work out of the box.
# WorkSpacesClient usage example
from boto3.session import Session
session = Session()
client = session.client("workspaces") # (1)
result = client.accept_account_link_invitation() # (2)
- client: WorkSpacesClient
- result: AcceptAccountLinkInvitationResultTypeDef
# DescribeAccountModificationsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("workspaces") # (1)
paginator = client.get_paginator("describe_account_modifications") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: WorkSpacesClient
- paginator: DescribeAccountModificationsPaginator
- item: DescribeAccountModificationsResultTypeDef
Explicit type annotations#
With boto3-stubs-lite[workspaces]
or a standalone mypy_boto3_workspaces
package, you have to explicitly specify client: WorkSpacesClient
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.
# WorkSpacesClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_workspaces.client import WorkSpacesClient
from mypy_boto3_workspaces.type_defs import AcceptAccountLinkInvitationResultTypeDef
from mypy_boto3_workspaces.type_defs import AcceptAccountLinkInvitationRequestRequestTypeDef
session = Session()
client: WorkSpacesClient = session.client("workspaces")
kwargs: AcceptAccountLinkInvitationRequestRequestTypeDef = {...}
result: AcceptAccountLinkInvitationResultTypeDef = client.accept_account_link_invitation(**kwargs)
# DescribeAccountModificationsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_workspaces.client import WorkSpacesClient
from mypy_boto3_workspaces.paginator import DescribeAccountModificationsPaginator
from mypy_boto3_workspaces.type_defs import DescribeAccountModificationsResultTypeDef
session = Session()
client: WorkSpacesClient = session.client("workspaces")
paginator: DescribeAccountModificationsPaginator = client.get_paginator("describe_account_modifications")
for item in paginator.paginate(...):
item: DescribeAccountModificationsResultTypeDef
print(item)