Skip to content

Examples#

Index > SSO > Examples

Auto-generated documentation for SSO type annotations stubs module types-aiobotocore-sso.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[sso] package installed.

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

# SSOClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("sso") as client:  # (1)
    result = await client.get_role_credentials()  # (2)
  1. client: SSOClient
  2. result: GetRoleCredentialsResponseTypeDef
# ListAccountRolesPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("sso") as client:  # (1)
    paginator = client.get_paginator("list_account_roles")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: SSOClient
  2. paginator: ListAccountRolesPaginator
  3. item: ListAccountRolesResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[sso] or a standalone types_aiobotocore_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.

# SSOClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_sso.client import SSOClient
from types_aiobotocore_sso.type_defs import GetRoleCredentialsResponseTypeDef
from types_aiobotocore_sso.type_defs import GetRoleCredentialsRequestRequestTypeDef


session = get_session()

async with session.create_client("sso") as client:
    client: SSOClient
    kwargs: GetRoleCredentialsRequestRequestTypeDef = {...}
    result: GetRoleCredentialsResponseTypeDef = await client.get_role_credentials(**kwargs)
# ListAccountRolesPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_sso.client import SSOClient
from types_aiobotocore_sso.paginator import ListAccountRolesPaginator
from types_aiobotocore_sso.type_defs import ListAccountRolesResponseTypeDef


session = get_session()

async with session.create_client("sso") as client:
    client: SSOClient
    paginator: ListAccountRolesPaginator = client.get_paginator("list_account_roles")
    async for item in paginator.paginate(...):
        item: ListAccountRolesResponseTypeDef
        print(item)