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