mypy-boto3-managedblockchain-query Type Annotations

1.42.3 · active · verified Sat Apr 11

mypy-boto3-managedblockchain-query provides type annotations for the boto3 ManagedBlockchainQuery service (version 1.42.3), generated using mypy-boto3-builder 8.12.0. This library enhances developer experience by enabling static type checking and IDE autocompletion for AWS ManagedBlockchainQuery client operations. It is actively maintained with releases frequently aligned with boto3 and mypy-boto3-builder updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a type-hinted ManagedBlockchainQuery client and make a sample API call using the `list_transactions` method. It shows the expected type annotations for the client object and the response structure, enabling better static analysis and autocompletion.

import boto3
from mypy_boto3_managedblockchain_query.client import ManagedBlockchainQueryClient
from mypy_boto3_managedblockchain_query.type_defs import ListTransactionsOutputTypeDef

# Ensure AWS credentials (e.g., via ~/.aws/credentials or environment variables)
# and region are configured for boto3 to function.

client: ManagedBlockchainQueryClient = boto3.client("managedblockchain-query")

try:
    # Example: List transactions for a specific network and address
    # Replace 'ETHEREUM_MAINNET' and '0x...' with actual values for your use case.
    # 'fromBlock' and 'toBlock' are placeholders; use appropriate values or remove if not needed.
    response: ListTransactionsOutputTypeDef = client.list_transactions(
        network="ETHEREUM_MAINNET",
        address="0x...", # Placeholder: Replace with a valid blockchain address
        fromBlock='0',
        toBlock='latest'
    )

    print("Transactions found:")
    for transaction in response.get("transactions", []):
        print(f"  Transaction ID: {transaction['transactionId']}")

    next_token = response.get("nextToken")
    if next_token:
        print(f"  Next Token: {next_token}")

except client.exceptions.ResourceNotFoundException as e:
    print(f"Error: Resource not found - {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →