mypy-boto3-mediatailor: Type Annotations for AWS MediaTailor

1.42.84 · active · verified Sat Apr 11

mypy-boto3-mediatailor provides PEP 561 compliant type annotations for the AWS MediaTailor service client in `boto3`. It enhances development with static type checking for `boto3` interactions, helping catch errors before runtime. This package is currently at version 1.42.84 and is part of the `mypy-boto3-builder` ecosystem, which follows a frequent release cadence, often synchronised with `boto3` updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a type-hinted MediaTailor client and perform a basic API call (list_channels). It highlights how to apply type annotations to the client object and API responses, leveraging the benefits of static type checking with `mypy` or similar tools.

import boto3
from mypy_boto3_mediatailor.client import MediaTailorClient
from mypy_boto3_mediatailor.type_defs import ListChannelsResponseTypeDef

# Create a typed client for AWS MediaTailor
client: MediaTailorClient = boto3.client("mediatailor")

# Example: List channels with type hints
try:
    response: ListChannelsResponseTypeDef = client.list_channels()
    channels = response.get('Items', [])
    print(f"Found {len(channels)} MediaTailor Channels:")
    for channel in channels:
        print(f"- {channel.get('ChannelName', 'N/A')} (ARN: {channel.get('ChannelArn', 'N/A')})")
except Exception as e:
    print(f"Error listing channels: {e}")
    print("Ensure AWS credentials and 'mediatailor' service are configured correctly.")

view raw JSON →