mypy-boto3-kinesis-video-media Type Stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-kinesis-video-media provides type annotations for the `boto3` Kinesis Video Media service, enabling static type checking with tools like Mypy. It is part of the `mypy-boto3` project which generates comprehensive type stubs for all AWS services supported by `boto3`. The current version is 1.42.3, and new versions are released frequently, synchronized with `boto3`/`botocore` updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a `boto3` Kinesis Video Media client and explicitly type it using the `mypy-boto3-kinesis-video-media` stubs. This allows static analysis tools like Mypy to provide autocompletion and validate method calls against the AWS API specification. Note that actual API calls require a properly configured AWS environment and valid stream ARNs.

import boto3
from typing import TYPE_CHECKING

# These type imports are only needed for explicit annotations during type checking.
# Mypy often discovers them automatically if the stubs are installed.
if TYPE_CHECKING:
    from mypy_boto3_kinesis_video_media.client import KinesisVideoMediaClient
    from mypy_boto3_kinesis_video_media.type_defs import GetMediaInputRequestTypeDef


def get_kinesis_video_media_client():
    # In a real application, ensure credentials/region are configured
    # via environment variables, ~/.aws/credentials, or boto3 session config.
    # For this example, we assume default configuration.
    client = boto3.client("kinesis-video-media")
    
    # For static type checking with Mypy, you can explicitly annotate the client.
    if TYPE_CHECKING:
        typed_client: KinesisVideoMediaClient = client
        # Example of using a TypedDict from the stubs
        get_media_params: GetMediaInputRequestTypeDef = {
            "StreamARN": "arn:aws:kinesisvideo:REGION:ACCOUNT_ID:stream/YOUR_STREAM/1234567890123",
            "StartSelector": {"StartSelectorType": "NOW"}
        }
        print(f"Client with type hints ready: {typed_client}")
        # Mypy will now validate calls to `typed_client` based on KinesisVideoMedia API.
        # Example (commented out as it requires a live stream and specific permissions):
        # response = typed_client.get_media(**get_media_params)
        # print(f"Response: {response}")
    else:
        print(f"Runtime client: {client}")

get_kinesis_video_media_client()

view raw JSON →