python - 请求 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>
- AmazonRoute53DomainsFullAccess
- AmazonRoute53FullAccess
但响应为空。
并且请求 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 请求都可以正常工作!
为什么?有什么问题?请帮助我,谢谢!
解决方案
Route53domains 客户端操作列出所有域的实际语法是:
response = client.list_domains(
Marker='string',
MaxItems=123
)
如果与当前 AWS 账户关联的域数大于您为 MaxItems 指定的值,您可以使用 Marker 返回其他域。
请参阅 Route53Domains的boto3文档
推荐阅读
- javascript - 为什么 jQuery 提交没有将填充有 ng-value 的数据发送到服务器端?
- python - 如何保持字符串中的变量不改变python
- cordova - Cordova 插件从本机函数获取异步响应
- git - 来自bitbucket服务器的Git克隆不适用于https
- python - 在 Linux 中未使用 load_dotenv() 加载环境变量
- javascript - 设置后环境变量仍未定义
- c++ - 特化包含自身的类型的非类型模板
- python - 是否可以根据时间序列在 Pandas 上创建一个新的数据框,并具有每日差异?
- node.js - 使用 Node.js,如果 dotenv 不包含在 app.js 之外的其他文件中,为什么会触发错误?
- android - 生成APK时Android在改造中的不同行为