首页 > 解决方案 > 请求 routed53omains API 有问题

问题描述

访问 routedomains 模块 API 时出现问题。

代码:

#!/usr/bin/python3.6
#encoding: utf-8
import boto3

key_id='xxxxxxxx'
access_key='xxxxxxxx'
client = boto3.client(
        'route53domains',
        aws_access_key_id = key_id,
        aws_secret_access_key = access_key,
        region_name = 'us-east-1'
)
all_domains= client.list_domains(DomainName="mydomain.com")
print(all_domains)

运行结果:

[]

我可以确认帐户下有多个域名(key_id 和 access_key)。并给予足够的权限:</p>

但响应为空。

并且请求 Route53 modules api 没有问题:

client = boto3.client(
        'route53',
        region_name = 'us-east-1',
        aws_access_key_id = "xxxxxxxxxxxx",
        aws_secret_access_key = "xxxxxxxxxxxx"
)
client.get_paginator('list_hosted_zones')

我的另一个帐户 Route53 和 Route53domain 请求都可以正常工作!

为什么?有什么问题?请帮助我,谢谢!

标签: pythonamazon-web-servicesboto3

解决方案


Route53domains 客户端操作列出所有域的实际语法是:

response = client.list_domains(
    Marker='string',
    MaxItems=123
)

如果与当前 AWS 账户关联的域数大于您为 MaxItems 指定的值,您可以使用 Marker 返回其他域。

请参阅 Route53Domains的boto3文档


推荐阅读