Skip to content

Examples#

Index > Personalize > Examples

Auto-generated documentation for Personalize type annotations stubs module types-aiobotocore-personalize.

Client#

Implicit type annotations#

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

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

# PersonalizeClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("personalize") as client:  # (1)
    result = await client.create_batch_inference_job()  # (2)
  1. client: PersonalizeClient
  2. result: CreateBatchInferenceJobResponseTypeDef
# ListBatchInferenceJobsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("personalize") as client:  # (1)
    paginator = client.get_paginator("list_batch_inference_jobs")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: PersonalizeClient
  2. paginator: ListBatchInferenceJobsPaginator
  3. item: ListBatchInferenceJobsResponseTypeDef

Explicit type annotations#

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

# PersonalizeClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_personalize.client import PersonalizeClient
from types_aiobotocore_personalize.type_defs import CreateBatchInferenceJobResponseTypeDef
from types_aiobotocore_personalize.type_defs import CreateBatchInferenceJobRequestRequestTypeDef


session = get_session()

async with session.create_client("personalize") as client:
    client: PersonalizeClient
    kwargs: CreateBatchInferenceJobRequestRequestTypeDef = {...}
    result: CreateBatchInferenceJobResponseTypeDef = await client.create_batch_inference_job(**kwargs)
# ListBatchInferenceJobsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_personalize.client import PersonalizeClient
from types_aiobotocore_personalize.paginator import ListBatchInferenceJobsPaginator
from types_aiobotocore_personalize.type_defs import ListBatchInferenceJobsResponseTypeDef


session = get_session()

async with session.create_client("personalize") as client:
    client: PersonalizeClient
    paginator: ListBatchInferenceJobsPaginator = client.get_paginator("list_batch_inference_jobs")
    async for item in paginator.paginate(...):
        item: ListBatchInferenceJobsResponseTypeDef
        print(item)