Examples#
Auto-generated documentation for Kinesis type annotations stubs module types-boto3-kinesis.
Client#
Implicit type annotations#
Can be used with types-boto3[kinesis]
package installed.
Write your Kinesis
code as usual,
type checking and code completion should work out of the box.
# KinesisClient usage example
from boto3.session import Session
session = Session()
client = session.client("kinesis") # (1)
result = client.add_tags_to_stream() # (2)
- client: KinesisClient
- result: EmptyResponseMetadataTypeDef
# DescribeStreamPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("kinesis") # (1)
paginator = client.get_paginator("describe_stream") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: KinesisClient
- paginator: DescribeStreamPaginator
- item: DescribeStreamOutputTypeDef
# StreamExistsWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("kinesis") # (1)
waiter = client.get_waiter("stream_exists") # (2)
waiter.wait()
- client: KinesisClient
- waiter: StreamExistsWaiter
Explicit type annotations#
With types-boto3-lite[kinesis]
or a standalone types_boto3_kinesis
package, you have to explicitly specify client: KinesisClient
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.
# KinesisClient usage example with type annotations
from boto3.session import Session
from types_boto3_kinesis.client import KinesisClient
from types_boto3_kinesis.type_defs import EmptyResponseMetadataTypeDef
from types_boto3_kinesis.type_defs import AddTagsToStreamInputRequestTypeDef
session = Session()
client: KinesisClient = session.client("kinesis")
kwargs: AddTagsToStreamInputRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.add_tags_to_stream(**kwargs)
# DescribeStreamPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_kinesis.client import KinesisClient
from types_boto3_kinesis.paginator import DescribeStreamPaginator
from types_boto3_kinesis.type_defs import DescribeStreamOutputTypeDef
session = Session()
client: KinesisClient = session.client("kinesis")
paginator: DescribeStreamPaginator = client.get_paginator("describe_stream")
for item in paginator.paginate(...):
item: DescribeStreamOutputTypeDef
print(item)
# StreamExistsWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_kinesis.client import KinesisClient
from types_boto3_kinesis.waiter import StreamExistsWaiter
session = Session()
client: KinesisClient = session.client("kinesis")
waiter: StreamExistsWaiter = client.get_waiter("stream_exists")
waiter.wait()