Skip to content

Examples#

Index > Macie > Examples

Auto-generated documentation for Macie type annotations stubs module types-aiobotocore-macie.

Client#

Implicit type annotations#

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

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

# MacieClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("macie") as client:  # (1)
    result = await client.associate_member_account()  # (2)
  1. client: MacieClient
  2. result: EmptyResponseMetadataTypeDef
# ListMemberAccountsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("macie") as client:  # (1)
    paginator = client.get_paginator("list_member_accounts")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: MacieClient
  2. paginator: ListMemberAccountsPaginator
  3. item: ListMemberAccountsResultTypeDef

Explicit type annotations#

With types-aiobotocore-lite[macie] or a standalone types_aiobotocore_macie package, you have to explicitly specify client: MacieClient 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.

# MacieClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_macie.client import MacieClient
from types_aiobotocore_macie.type_defs import EmptyResponseMetadataTypeDef
from types_aiobotocore_macie.type_defs import AssociateMemberAccountRequestRequestTypeDef


session = get_session()

async with session.create_client("macie") as client:
    client: MacieClient
    kwargs: AssociateMemberAccountRequestRequestTypeDef = {...}
    result: EmptyResponseMetadataTypeDef = await client.associate_member_account(**kwargs)
# ListMemberAccountsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_macie.client import MacieClient
from types_aiobotocore_macie.paginator import ListMemberAccountsPaginator
from types_aiobotocore_macie.type_defs import ListMemberAccountsResultTypeDef


session = get_session()

async with session.create_client("macie") as client:
    client: MacieClient
    paginator: ListMemberAccountsPaginator = client.get_paginator("list_member_accounts")
    async for item in paginator.paginate(...):
        item: ListMemberAccountsResultTypeDef
        print(item)