Skip to content

Examples#

Index > Connect > Examples

Auto-generated documentation for Connect type annotations stubs module types-aiobotocore-connect.

Client#

Implicit type annotations#

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

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

# ConnectClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("connect") as client:  # (1)
    result = await client.activate_evaluation_form()  # (2)
  1. client: ConnectClient
  2. result: ActivateEvaluationFormResponseTypeDef
# GetMetricDataPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("connect") as client:  # (1)
    paginator = client.get_paginator("get_metric_data")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: ConnectClient
  2. paginator: GetMetricDataPaginator
  3. item: GetMetricDataResponseTypeDef

Explicit type annotations#

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

# ConnectClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_connect.client import ConnectClient
from types_aiobotocore_connect.type_defs import ActivateEvaluationFormResponseTypeDef
from types_aiobotocore_connect.type_defs import ActivateEvaluationFormRequestRequestTypeDef


session = get_session()

async with session.create_client("connect") as client:
    client: ConnectClient
    kwargs: ActivateEvaluationFormRequestRequestTypeDef = {...}
    result: ActivateEvaluationFormResponseTypeDef = await client.activate_evaluation_form(**kwargs)
# GetMetricDataPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_connect.client import ConnectClient
from types_aiobotocore_connect.paginator import GetMetricDataPaginator
from types_aiobotocore_connect.type_defs import GetMetricDataResponseTypeDef


session = get_session()

async with session.create_client("connect") as client:
    client: ConnectClient
    paginator: GetMetricDataPaginator = client.get_paginator("get_metric_data")
    async for item in paginator.paginate(...):
        item: GetMetricDataResponseTypeDef
        print(item)