mypy-boto3-kinesis-video-webrtc-storage Type Stubs

1.42.3 · active · verified Sat Apr 11

This package provides type annotations (stubs) for the `boto3` Kinesis Video WebRTC Storage service. It enables static type checking for `boto3` code using tools like MyPy, improving code quality and catching errors early. The current version is 1.42.3, generated with `mypy-boto3-builder 8.12.0`. Releases are frequent, typically in sync with `boto3` versions and updates to the `mypy-boto3-builder`.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a type-hinted Kinesis Video WebRTC Storage client and call its primary `join_storage_session` method. The `if TYPE_CHECKING:` block ensures that your IDE and MyPy can provide full type-safety for the client while allowing standard Boto3 runtime behavior. Remember to replace the placeholder `channel_arn` with a valid AWS resource in your environment.

import os
import boto3
from mypy_boto3_kinesis_video_webrtc_storage import KinesisVideoWebRTCStorageClient
from typing import TYPE_CHECKING

# This block is purely for type checking tools like MyPy.
# At runtime, this block is skipped.
if TYPE_CHECKING:
    # 'client' will be correctly typed as KinesisVideoWebRTCStorageClient.
    # This allows your IDE and MyPy to provide autocomplete and type validation
    # for all service-specific methods and parameters.
    client: KinesisVideoWebRTCStorageClient = boto3.client("kinesis-video-webrtc-storage")
else:
    # At runtime, 'client' is a standard Boto3 client.
    client = boto3.client("kinesis-video-webrtc-storage")

print(f"Boto3 client for Kinesis Video WebRTC Storage created: {type(client)}")

# The KinesisVideoWebRTCStorage service currently has only one primary client operation:
# `join_storage_session`. This operation typically integrates with other Kinesis Video
# services and does not return complex data directly.
# For a runnable example, we'll use a placeholder for ChannelArn.
# In a real application, ensure this ARN is valid and accessible.
channel_arn = os.environ.get(
    "KINESIS_VIDEO_WEBRTC_CHANNEL_ARN",
    "arn:aws:kinesisvideo:us-east-1:123456789012:channel/example-channel/1234567890123"
)

# Calling a type-checked method:
# MyPy will validate that `ChannelArn` is a required string parameter.
try:
    print(f"Attempting to call join_storage_session for channel: {channel_arn}")
    response = client.join_storage_session(
        ChannelArn=channel_arn
    )
    # The join_storage_session operation returns an empty dictionary on success.
    print(f"Successfully called join_storage_session. Response: {response}")
    assert response == {} # Confirming an empty response
except client.exceptions.ResourceNotFoundException:
    print(f"Error: Kinesis Video WebRTC Storage channel '{channel_arn}' not found. Please ensure the ARN is correct and exists.")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →