mypy-boto3-route53-recovery-readiness

1.42.3 · active · verified Sat Apr 11

mypy-boto3-route53-recovery-readiness provides type annotations for the `boto3` AWS Route53RecoveryReadiness service, allowing static type checkers like `mypy` to validate `boto3` usage. It's currently at version 1.42.3 and is part of the `mypy-boto3-builder` ecosystem, which generates packages for all `boto3` services and is frequently updated, often in sync with `boto3` releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `mypy-boto3-route53-recovery-readiness` type stubs with a standard `boto3` client. When this code is run through `mypy`, it will ensure that the `client` object and the `response` adhere to the type definitions provided by the stub package, catching potential errors at compile time.

import boto3
from mypy_boto3_route53_recovery_readiness.client import Route53RecoveryReadinessClient
from mypy_boto3_route53_recovery_readiness.type_defs import ListReadinessChecksOutputTypeDef
import os

def get_readiness_checks() -> ListReadinessChecksOutputTypeDef:
    """Fetches a list of Route53 Recovery Readiness checks and returns their typed response."""
    # mypy-boto3 provides type hints for the boto3 client object
    client: Route53RecoveryReadinessClient = boto3.client(
        "route53-recovery-readiness",
        region_name=os.environ.get("AWS_REGION", "us-east-1")
    )
    response = client.list_readiness_checks()
    print(f"Found {len(response.get('ReadinessChecks', []))} readiness checks.")
    return response

if __name__ == "__main__":
    # When mypy is run on this file, it will verify that
    # `get_readiness_checks` returns a `ListReadinessChecksOutputTypeDef`
    # and that subsequent access to 'result' follows that type definition.
    result = get_readiness_checks()
    # Example of type-safe access:
    for check in result.get('ReadinessChecks', []):
        print(f"  - {check.get('ReadinessCheckName', 'N/A')}")

view raw JSON →