文章目录
2019-1-24 11:38:29
阿里云api简单使用
- api概述
- openapi(可查询api具体使用方法)
- 获取id信息
- api演示界面
使用
#!/usr/bin/env python
#coding=utf-8
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest
client = AcsClient('此次填写ID', '此处填写Key Secret', 'default')
request = CommonRequest()
request.set_accept_format('json')
request.set_domain('domain.aliyuncs.com')
request.set_method('POST')
request.set_version('2018-01-29')
request.set_action_name('QueryDomainList')
request.add_query_param('PageNum', '1')
request.add_query_param('PageSize', '102400')
response = client.do_action(request)
##Python2版本
print(response)
##Python3版本
#print(str(response, encoding = 'utf-8'))
----------------结果-------------------------
{"Data":{"Domain":[{"RegistrationDateLong":1506059362000,"InstanceId":"S20177D12AP59648","DomainStatus":"3","ExpirationDateStatus":"1","DomainAuditStatus":"SUCCEED","ExpirationDateLong":1569131362000,"Premium":false,"ProductId":"2a","ExpirationDate":"2019-09-22 13:49:22","RegistrantType":"1","RegistrationDate":"2017-09-22 13:49:22","DomainName":"xiaoqying.com","DomainType":"gTLD","ExpirationCurrDateDiff":241}]},"TotalItemNum":1,"PageSize":1000,"CurrentPageNum":1,"RequestId":"9AEFE619-AB4A-4FF9-83CF-850726F8636C","PrePage":false,"TotalPageNum":1,"NextPage":false}