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