mypy-boto3-route53 Type Annotations

1.42.6 · active · verified Sat Apr 11

mypy-boto3-route53 provides comprehensive type annotations for the Amazon Route53 service client in `boto3`. It enhances development with static type checking, autocompletion, and improved readability for AWS interactions. The current version is 1.42.6, generated with `mypy-boto3-builder 8.12.0`, and it typically releases new versions in sync with `boto3` and `botocore` updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a Route53 client with type hints and retrieve a list of hosted zones. It explicitly types the `boto3` client and the API response, allowing `mypy` to validate usage and provide autocompletion.

import boto3
from mypy_boto3_route53 import Route53Client
from mypy_boto3_route53.type_defs import ListHostedZonesResponseTypeDef

def get_hosted_zones() -> ListHostedZonesResponseTypeDef:
    # boto3.client is untyped by default
    client: Route53Client = boto3.client("route53")
    
    response: ListHostedZonesResponseTypeDef = client.list_hosted_zones()
    print(f"Found {len(response.get('HostedZones', []))} hosted zones.")
    for zone in response.get('HostedZones', []):
        print(f"  - {zone.get('Name')} ({zone.get('Id')})")
    return response

if __name__ == "__main__":
    get_hosted_zones()

view raw JSON →