mypy-boto3-support

1.42.3 · active · verified Sat Apr 11

mypy-boto3-support provides type annotations for the AWS boto3 Support service. It enhances static type checking for boto3 clients, resources, and various response/request structures related to AWS Support. The current version is 1.42.3, and its releases are frequently tied to new `boto3` versions and `mypy-boto3-builder` updates, ensuring up-to-date type definitions.

Warnings

Install

Imports

Quickstart

This example demonstrates how to use `boto3` with `mypy-boto3-support` for type-hinted AWS Support service calls. The `TYPE_CHECKING` block ensures that type-specific imports are only active during static analysis, avoiding runtime import issues.

import boto3
from typing import TYPE_CHECKING

# The mypy-boto3-support package provides stubs for boto3's 'support' service.
# The actual runtime client comes from boto3.

if TYPE_CHECKING:
    from mypy_boto3_support.client import SupportClient
    from mypy_boto3_support.type_defs import DescribeCasesResponseTypeDef

def get_aws_support_cases() -> None:
    # mypy will use the stubs to type-check this client
    client: SupportClient = boto3.client("support")
    
    # Example: Describe cases. Replace with actual parameters if needed.
    # Using try-except for a more robust example, as actual AWS calls require credentials.
    try:
        response: DescribeCasesResponseTypeDef = client.describe_cases(displayId='case-000000000001')
        print(f"Successfully described cases. Cases found: {len(response.get('cases', []))}")
        if response.get('cases'):
            print(f"First case ID: {response['cases'][0]['caseId']}")
    except Exception as e:
        print(f"Error describing cases: {e}")
        print("Ensure you have AWS credentials configured and the 'support' service is enabled.")

if __name__ == "__main__":
    get_aws_support_cases()

view raw JSON →