Skip to content

Examples#

Index > Kinesis > 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.

Client method usage example#

# KinesisClient usage example

from boto3.session import Session


session = Session()

client = session.client("kinesis")  # (1)
result = client.add_tags_to_stream()  # (2)
  1. client: KinesisClient
  2. result: EmptyResponseMetadataTypeDef

Paginator usage example#

# 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)
  1. client: KinesisClient
  2. paginator: DescribeStreamPaginator
  3. item: DescribeStreamOutputTypeDef

Waiter usage example#

# StreamExistsWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("stream_exists")  # (2)
waiter.wait(...)
  1. client: KinesisClient
  2. 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.

Client method usage example#

# 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 AddTagsToStreamInputTypeDef


session = Session()

client: KinesisClient = session.client("kinesis")

kwargs: AddTagsToStreamInputTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.add_tags_to_stream(**kwargs)

Paginator usage example#

# 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)

Waiter usage example#

# 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(...)