Examples#
Index > KafkaConnect > Examples
Auto-generated documentation for KafkaConnect type annotations stubs module mypy-boto3-kafkaconnect.
Client#
Implicit type annotations#
Can be used with boto3-stubs[kafkaconnect]
package installed.
Write your KafkaConnect
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# KafkaConnectClient usage example
from boto3.session import Session
session = Session()
client = session.client("kafkaconnect") # (1)
result = client.create_connector() # (2)
- client: KafkaConnectClient
- result: CreateConnectorResponseTypeDef
Paginator usage example#
# ListConnectorOperationsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("kafkaconnect") # (1)
paginator = client.get_paginator("list_connector_operations") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: KafkaConnectClient
- paginator: ListConnectorOperationsPaginator
- item: ListConnectorOperationsResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[kafkaconnect]
or a standalone mypy_boto3_kafkaconnect
package, you have to explicitly specify client: KafkaConnectClient
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.
Client method usage example#
# KafkaConnectClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_kafkaconnect.client import KafkaConnectClient
from mypy_boto3_kafkaconnect.type_defs import CreateConnectorResponseTypeDef
from mypy_boto3_kafkaconnect.type_defs import CreateConnectorRequestTypeDef
session = Session()
client: KafkaConnectClient = session.client("kafkaconnect")
kwargs: CreateConnectorRequestTypeDef = {...}
result: CreateConnectorResponseTypeDef = client.create_connector(**kwargs)
Paginator usage example#
# ListConnectorOperationsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_kafkaconnect.client import KafkaConnectClient
from mypy_boto3_kafkaconnect.paginator import ListConnectorOperationsPaginator
from mypy_boto3_kafkaconnect.type_defs import ListConnectorOperationsResponseTypeDef
session = Session()
client: KafkaConnectClient = session.client("kafkaconnect")
paginator: ListConnectorOperationsPaginator = client.get_paginator("list_connector_operations")
for item in paginator.paginate(...):
item: ListConnectorOperationsResponseTypeDef
print(item)