mypy-boto3-resiliencehub Type Stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-resiliencehub provides static type annotations for the `boto3` Resilience Hub service client. It is part of the `mypy-boto3` collection, generated by `mypy-boto3-builder`, aiming to improve developer experience by enabling type checking for AWS SDK for Python (boto3) code. The package version `1.42.3` corresponds to the `boto3` version it types. This project is actively maintained with frequent updates to align with new `boto3` releases and address issues.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a typed Resilience Hub client and use it to list applications, benefiting from static type checking for method calls and response structures.

import os
import boto3
from mypy_boto3_resiliencehub.client import ResilienceHubClient
from mypy_boto3_resiliencehub.type_defs import ListAppsOutputTypeDef

# Ensure boto3 is configured, e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME env vars
# Or AWS_PROFILE and AWS_REGION

region_name = os.environ.get('AWS_REGION_NAME', 'us-east-1')
client: ResilienceHubClient = boto3.client("resiliencehub", region_name=region_name)

try:
    print(f"Attempting to list Resilience Hub applications in {region_name}...")
    response: ListAppsOutputTypeDef = client.list_apps()
    apps = response.get('apps', [])
    print(f"Successfully listed {len(apps)} Resilience Hub applications.")
    for app in apps:
        print(f"  - App Name: {app.get('name')}, Status: {app.get('status')}")
except Exception as e:
    print(f"Error listing Resilience Hub applications: {e}")
    print("Please ensure you have configured AWS credentials and the ResilienceHub service is available in your region.")

view raw JSON →