mypy-boto3-kinesisvideo

1.42.3 · active · verified Sat Apr 11

mypy-boto3-kinesisvideo provides type annotations for the `boto3` KinesisVideo service, ensuring type compatibility with tools like mypy, VSCode, and PyCharm. It is automatically generated by `mypy-boto3-builder` and released frequently, often in sync with `boto3` updates to maintain accurate type hints for the latest AWS API specifications. The current version is 1.42.3.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted KinesisVideo client using `boto3` and perform a `list_streams` operation. The `TYPE_CHECKING` block ensures that `mypy_boto3_kinesisvideo` is only imported during type checking, avoiding a runtime dependency if not strictly needed in production code.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_kinesisvideo.client import KinesisVideoClient
    from mypy_boto3_kinesisvideo.type_defs import ListStreamsOutputTypeDef

def get_kinesisvideo_client() -> 'KinesisVideoClient':
    # In a real application, credentials and region would be configured
    # via environment variables, ~/.aws/credentials, or other boto3 methods.
    # Using os.environ.get for example runnable code.
    session = boto3.Session(
        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'test'),
        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'test'),
        region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')
    )
    client: KinesisVideoClient = session.client("kinesisvideo")
    return client

def list_kinesis_streams():
    client = get_kinesisvideo_client()
    response: ListStreamsOutputTypeDef = client.list_streams()
    print("Kinesis Video Streams:")
    for stream_info in response.get('StreamInfoList', []):
        print(f"  - {stream_info.get('StreamName')} (ARN: {stream_info.get('StreamARN')})")

# Example usage:
if __name__ == '__main__':
    import os
    # Set dummy AWS credentials for local execution if not already set
    # For actual AWS interaction, ensure valid credentials are configured.
    os.environ.setdefault('AWS_ACCESS_KEY_ID', 'AKIAIOSFODNN7EXAMPLE')
    os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY')
    os.environ.setdefault('AWS_DEFAULT_REGION', 'us-east-1')
    
    try:
        list_kinesis_streams()
    except Exception as e:
        print(f"An error occurred: {e}")
        print("Please ensure AWS credentials are correctly configured if you expect real data.")

view raw JSON →