mypy-boto3-simpledbv2

1.42.66 · active · verified Wed Apr 15

mypy-boto3-simpledbv2 provides precise type annotations for the boto3 SimpleDBv2 client, enhancing type checking for AWS SDK usage. It is part of the `mypy-boto3` project, which generates stubs for all boto3 services. The current version is 1.42.66, and it updates frequently, typically in sync with `boto3` and `botocore` releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a type-hinted SimpleDBv2 client and list available domains. The `mypy-boto3-simpledbv2` package provides the `SimpleDBv2Client` type, allowing static analysis tools like Mypy to verify your code against the AWS API.

import boto3
from mypy_boto3_simpledbv2.client import SimpleDBv2Client
from botocore.exceptions import ClientError

def list_simpledb_domains():
    """Lists SimpleDB domains using a typed boto3 client."""
    try:
        # Initialize a typed SimpleDBv2 client
        client: SimpleDBv2Client = boto3.client("sdb")

        # List domains with type-hinted response
        response = client.list_domains(MaxNumberOfDomains=10)
        
        print(f"SimpleDB Domains: {response.get('DomainNames', [])}")
        if response.get("NextToken"):
            print("More domains available (use NextToken).")

    except ClientError as e:
        print(f"Error listing SimpleDB domains: {e}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

if __name__ == "__main__":
    # Ensure AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials)
    list_simpledb_domains()

view raw JSON →