Skip to content

Examples#

Index > Route53 > Examples

Auto-generated documentation for Route53 type annotations stubs module mypy-boto3-route53.

Client#

Implicit type annotations#

Can be used with boto3-stubs[route53] package installed.

Write your Route53 code as usual, type checking and code completion should work out of the box.

Client method usage example#

# Route53Client usage example

from boto3.session import Session


session = Session()

client = session.client("route53")  # (1)
result = client.activate_key_signing_key()  # (2)
  1. client: Route53Client
  2. result: ActivateKeySigningKeyResponseTypeDef

Paginator usage example#

# ListCidrBlocksPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("route53")  # (1)

paginator = client.get_paginator("list_cidr_blocks")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: Route53Client
  2. paginator: ListCidrBlocksPaginator
  3. item: ListCidrBlocksResponseTypeDef

Waiter usage example#

# ResourceRecordSetsChangedWaiter usage example

from boto3.session import Session


session = Session()
client = session.client("route53")  # (1)

waiter = client.get_waiter("resource_record_sets_changed")  # (2)
waiter.wait(...)
  1. client: Route53Client
  2. waiter: ResourceRecordSetsChangedWaiter

Explicit type annotations#

With boto3-stubs-lite[route53] or a standalone mypy_boto3_route53 package, you have to explicitly specify client: Route53Client type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

Client method usage example#

# Route53Client usage example with type annotations

from boto3.session import Session

from mypy_boto3_route53.client import Route53Client
from mypy_boto3_route53.type_defs import ActivateKeySigningKeyResponseTypeDef
from mypy_boto3_route53.type_defs import ActivateKeySigningKeyRequestTypeDef


session = Session()

client: Route53Client = session.client("route53")

kwargs: ActivateKeySigningKeyRequestTypeDef = {...}
result: ActivateKeySigningKeyResponseTypeDef = client.activate_key_signing_key(**kwargs)

Paginator usage example#

# ListCidrBlocksPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_route53.client import Route53Client
from mypy_boto3_route53.paginator import ListCidrBlocksPaginator
from mypy_boto3_route53.type_defs import ListCidrBlocksResponseTypeDef


session = Session()
client: Route53Client = session.client("route53")

paginator: ListCidrBlocksPaginator = client.get_paginator("list_cidr_blocks")
for item in paginator.paginate(...):
    item: ListCidrBlocksResponseTypeDef
    print(item)

Waiter usage example#

# ResourceRecordSetsChangedWaiter usage example with type annotations

from boto3.session import Session

from mypy_boto3_route53.client import Route53Client
from mypy_boto3_route53.waiter import ResourceRecordSetsChangedWaiter

session = Session()
client: Route53Client = session.client("route53")

waiter: ResourceRecordSetsChangedWaiter = client.get_waiter("resource_record_sets_changed")
waiter.wait(...)