mypy-boto3-route53globalresolver Type Stubs
mypy-boto3-route53globalresolver provides type annotations for the boto3 Route53GlobalResolver client, enabling static type checking with tools like MyPy. It ensures type safety for AWS API calls made via boto3. The library is part of the larger `mypy-boto3-builder` ecosystem, which typically releases updates frequently, synchronized with new boto3 releases and AWS service updates.
Warnings
- breaking Python 3.8 support has been removed for all `mypy-boto3` packages, including `mypy-boto3-route53globalresolver`. Requires Python 3.9 or higher.
- gotcha This package provides only type stubs. You must install `boto3` separately to use the AWS SDK at runtime.
- gotcha For optimal type checking, align the `mypy-boto3-route53globalresolver` version with your `boto3` version. The patch version (e.g., `1.42.64`) typically indicates the compatible `boto3` minor version (e.g., `boto3==1.42.x`).
- breaking The `mypy-boto3-builder` (which generates this stub) changed TypeDef naming conventions in 8.9.0. This might affect existing type hints if you've explicitly referenced generated TypeDefs (e.g., `CreateDistributionRequestRequestTypeDef` becoming `CreateDistributionRequestTypeDef`).
Install
-
pip install mypy-boto3-route53globalresolver boto3
Imports
- Route53GlobalResolverClient
from mypy_boto3_route53globalresolver.client import Route53GlobalResolverClient
Quickstart
import boto3
from mypy_boto3_route53globalresolver.client import Route53GlobalResolverClient
# Initialize a boto3 client for Route53GlobalResolver
# Ensure AWS credentials and region are configured via environment variables
# (e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME) or AWS config files.
client: Route53GlobalResolverClient = boto3.client("route53-global-resolver")
# Example usage: List Resolver Endpoints
# The exact API calls depend on the specific service functionality.
try:
response = client.list_resolver_endpoints(
MaxResults=5 # Limit results for a quick example
)
print(f"Successfully listed {len(response.get('ResolverEndpoints', []))} Resolver Endpoints.")
if response.get('ResolverEndpoints'):
first_endpoint = response['ResolverEndpoints'][0]
print(f"First endpoint ID: {first_endpoint.get('Id')}, Name: {first_endpoint.get('Name')}")
except Exception as e:
print(f"Error listing resolver endpoints: {e}")
# Type checking with MyPy will now ensure that 'client' methods and 'response' structure are correct.