Type Annotations for boto3 Kinesis Video Archived Media
This library provides precise type hints for `boto3`'s `KinesisVideoArchivedMedia` client, enabling static analysis tools like MyPy. It's an integral part of the `mypy-boto3` ecosystem, which generates stubs for all AWS services. The package is frequently updated, typically aligning with `boto3` and `botocore` releases, with the current version being `1.42.3`.
Warnings
- breaking Python 3.8 support was removed from `mypy-boto3` packages (including this one) starting from version 8.12.0. This package now requires Python 3.9 or newer.
- breaking TypeDef naming conventions changed in version 8.9.0. Some TypeDefs for method arguments might have shorter names (e.g., `*RequestRequestTypeDef` -> `*RequestTypeDef`) or have `Extra` postfixes moved. This could break explicit type annotations in existing code.
- gotcha You must install the `boto3` runtime library separately. `mypy-boto3-kinesis-video-archived-media` only provides type stubs (.pyi files) for `boto3`, not the actual runtime implementation.
- gotcha A version mismatch between `mypy-boto3-*` stub packages and your installed `boto3`/`botocore` runtime can lead to incorrect type hints or MyPy errors. Stubs are generated for specific `boto3` versions.
- gotcha The service name passed to `boto3.client()` (e.g., `"kinesis-video-archived-media"`) must exactly match the service stub package's internal naming convention for correct type application. Misspellings or using an old service name will result in untyped clients.
Install
-
pip install mypy-boto3-kinesis-video-archived-media boto3
Imports
- KinesisVideoArchivedMediaClient
from mypy_boto3_kinesis_video_archived_media import KinesisVideoArchivedMediaClient
- GetHLSStreamingSessionURLRequestRequestTypeDef
from mypy_boto3_kinesis_video_archived_media.type_defs import GetHLSStreamingSessionURLRequestRequestTypeDef
Quickstart
import boto3
from mypy_boto3_kinesis_video_archived_media import KinesisVideoArchivedMediaClient
# Instantiate the boto3 client normally.
# Mypy-boto3 provides the static type annotations at type-checking time.
client: KinesisVideoArchivedMediaClient = boto3.client(
"kinesis-video-archived-media",
region_name="us-east-1" # Ensure AWS credentials are configured (e.g., via env vars or ~/.aws/credentials)
)
# Now 'client' is statically typed as KinesisVideoArchivedMediaClient.
# MyPy will validate method calls and arguments, providing autocompletion and error checking.
# Example (uncomment to run, requires valid AWS credentials and Kinesis Video Stream):
# from mypy_boto3_kinesis_video_archived_media.type_defs import GetHLSStreamingSessionURLRequestRequestTypeDef
# request: GetHLSStreamingSessionURLRequestRequestTypeDef = {
# "StreamName": "your-stream-name",
# "PlaybackMode": "LIVE"
# }
# response = client.get_hls_streaming_session_url(**request)
# print(f"HLS Session URL: {response['HLSStreamingSessionURL']}")
print(f"Successfully created a typed Kinesis Video Archived Media client: {type(client)}")
print("MyPy will now provide type-checking for 'client' methods and arguments.")