Examples#
Auto-generated documentation for Connect type annotations stubs module mypy-boto3-connect.
Client#
Implicit type annotations#
Can be used with boto3-stubs[connect]
package installed.
Write your Connect
code as usual,
type checking and code completion should work out of the box.
# ConnectClient usage example
from boto3.session import Session
session = Session()
client = session.client("connect") # (1)
result = client.activate_evaluation_form() # (2)
- client: ConnectClient
- result: ActivateEvaluationFormResponseTypeDef
# GetMetricDataPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("connect") # (1)
paginator = client.get_paginator("get_metric_data") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: ConnectClient
- paginator: GetMetricDataPaginator
- item: GetMetricDataResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[connect]
or a standalone mypy_boto3_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 boto3.session import Session
from mypy_boto3_connect.client import ConnectClient
from mypy_boto3_connect.type_defs import ActivateEvaluationFormResponseTypeDef
from mypy_boto3_connect.type_defs import ActivateEvaluationFormRequestRequestTypeDef
session = Session()
client: ConnectClient = session.client("connect")
kwargs: ActivateEvaluationFormRequestRequestTypeDef = {...}
result: ActivateEvaluationFormResponseTypeDef = client.activate_evaluation_form(**kwargs)
# GetMetricDataPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_connect.client import ConnectClient
from mypy_boto3_connect.paginator import GetMetricDataPaginator
from mypy_boto3_connect.type_defs import GetMetricDataResponseTypeDef
session = Session()
client: ConnectClient = session.client("connect")
paginator: GetMetricDataPaginator = client.get_paginator("get_metric_data")
for item in paginator.paginate(...):
item: GetMetricDataResponseTypeDef
print(item)