mypy-boto3-kinesis-video-webrtc-storage Type Stubs
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
- breaking Python 3.8 is no longer supported for `mypy-boto3` packages. Ensure your project uses Python 3.9 or newer.
- breaking TypeDef naming conventions were changed to be shorter and more consistent (e.g., `RequestRequestTypeDef` became `RequestTypeDef`, and `Extra` postfix moved). If you have custom types or logic referencing older TypeDef names, they will break.
- gotcha This package provides *only* type stubs. You must install `boto3` separately for your code to function at runtime. These stubs enhance `boto3` with type hints, they do not replace it.
- gotcha For optimal type checking, the `mypy-boto3-*` stub version should align with the `boto3` version you are using (e.g., `mypy-boto3-kinesis-video-webrtc-storage==1.42.x` for `boto3==1.42.x`). Significant mismatches might lead to incomplete or incorrect type hints.
Install
-
pip install mypy-boto3-kinesis-video-webrtc-storage boto3
Imports
- KinesisVideoWebRTCStorageClient
from mypy_boto3_kinesis_video_webrtc_storage import KinesisVideoWebRTCStorageClient
- Client
from mypy_boto3_kinesis_video_webrtc_storage.client import KinesisVideoWebRTCStorageClient as Client
- KinesisVideoWebRTCStorageServiceResource
from mypy_boto3_kinesis_video_webrtc_storage import KinesisVideoWebRTCStorageServiceResource
Quickstart
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}")