mypy-boto3-mediastore

1.42.3 · active · verified Sat Apr 11

mypy-boto3-mediastore provides type annotations for the boto3 AWS MediaStore service. It is part of the `mypy-boto3` family of stub packages, generated by `mypy-boto3-builder`, and is frequently updated to align with `boto3` releases and AWS API changes. This allows for static type checking of boto3 client calls, enhancing code quality and developer experience.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `mypy-boto3-mediastore` for type-hinting a boto3 MediaStore client. It shows explicit type annotation for the client and the return type of a method call. To verify type checking, ensure `mypy` is installed and run `mypy` on the script.

import os
import boto3
from mypy_boto3_mediastore import MediaStoreClient
from mypy_boto3_mediastore.type_defs import ContainerTypeDef

def list_mediastore_containers(client: MediaStoreClient) -> list[ContainerTypeDef]:
    """Lists MediaStore containers and returns typed responses."""
    response = client.list_containers()
    containers = response.get('Containers', [])
    print(f"Found {len(containers)} MediaStore containers.")
    for container in containers:
        print(f"  Container Name: {container.get('Name')}, Status: {container.get('Status')}")
    return containers

if __name__ == "__main__":
    # Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)
    session = boto3.Session(region_name=os.environ.get('AWS_REGION', 'us-east-1'))
    mediastore_client: MediaStoreClient = session.client('mediastore')
    
    print("Listing MediaStore containers...")
    containers = list_mediastore_containers(mediastore_client)
    
    # Example of accessing a typed attribute (mypy would check this)
    if containers:
        first_container_arn: str = containers[0]['ARN']
        print(f"First container ARN: {first_container_arn}")

    # To run static analysis:
    # pip install mypy
    # mypy your_script_name.py

view raw JSON →