mypy-boto3-managedblockchain-query Type Annotations
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
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0, affecting all generated stub packages including `mypy-boto3-managedblockchain-query`. Users on Python 3.8 will need to upgrade to Python 3.9 or newer.
- breaking The `mypy-boto3-builder` (from version 8.12.0) migrated all generated packages to PEP 561-compliant stub packages. While generally beneficial, it changes how `mypy` discovers type information. If you were relying on custom `MYPYPATH` configurations for older `mypy-boto3` packages, you might need to adjust your setup as stub-only packages must be installed in the environment `mypy` checks.
- breaking Starting with `mypy-boto3-builder` 8.9.0, TypeDef names for packed method arguments may use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting TypeDef `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). If your code explicitly imported or referenced the older, longer TypeDef names from this package, it might break type checking.
- gotcha This package provides *only* type annotations. You must also install `boto3` (e.g., `pip install boto3`) for your code to function at runtime. Without `boto3` installed, your application will raise `ModuleNotFoundError` or similar runtime errors.
Install
-
pip install boto3 mypy-boto3-managedblockchain-query
Imports
- ManagedBlockchainQueryClient
from mypy_boto3_managedblockchain_query.client import ManagedBlockchainQueryClient
- ListTransactionsOutputTypeDef
from mypy_boto3_managedblockchain_query.type_defs import ListTransactionsOutputTypeDef
- ManagedBlockchainQueryServiceName
from mypy_boto3_managedblockchain_query.literals import ManagedBlockchainQueryServiceName
Quickstart
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}")