Skip to content

Examples#

Index > QConnect > Examples

Auto-generated documentation for QConnect type annotations stubs module mypy-boto3-qconnect.

Client#

Implicit type annotations#

Can be used with boto3-stubs[qconnect] package installed.

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

# QConnectClient usage example

from boto3.session import Session


session = Session()

client = session.client("qconnect")  # (1)
result = client.create_assistant()  # (2)
  1. client: QConnectClient
  2. result: CreateAssistantResponseTypeDef
# ListAssistantAssociationsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("qconnect")  # (1)

paginator = client.get_paginator("list_assistant_associations")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: QConnectClient
  2. paginator: ListAssistantAssociationsPaginator
  3. item: ListAssistantAssociationsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[qconnect] or a standalone mypy_boto3_qconnect package, you have to explicitly specify client: QConnectClient 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.

# QConnectClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_qconnect.client import QConnectClient
from mypy_boto3_qconnect.type_defs import CreateAssistantResponseTypeDef
from mypy_boto3_qconnect.type_defs import CreateAssistantRequestRequestTypeDef


session = Session()

client: QConnectClient = session.client("qconnect")

kwargs: CreateAssistantRequestRequestTypeDef = {...}
result: CreateAssistantResponseTypeDef = client.create_assistant(**kwargs)
# ListAssistantAssociationsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_qconnect.client import QConnectClient
from mypy_boto3_qconnect.paginator import ListAssistantAssociationsPaginator
from mypy_boto3_qconnect.type_defs import ListAssistantAssociationsResponseTypeDef


session = Session()
client: QConnectClient = session.client("qconnect")

paginator: ListAssistantAssociationsPaginator = client.get_paginator("list_assistant_associations")
for item in paginator.paginate(...):
    item: ListAssistantAssociationsResponseTypeDef
    print(item)