Skip to content

增加了python sdk三鉴功能 #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
添加获取域名列表的方法
  • Loading branch information
tonycai653 committed Jul 16, 2018
commit 61ee92e3e3290cb0644d4eabd1f38f856caeb2a1
12 changes: 12 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from qiniu import Auth, DomainManager

access_key = ''
secret_key = ''

at = Auth(access_key, secret_key)

dm = DomainManager(at)

for ret, resp_info in dm.get_domain_list(limit=100):
for domain in ret['domains']:
print(domain['name'])
19 changes: 19 additions & 0 deletions qiniu/services/cdn/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,25 @@ def get_domain(self, name):
url = '{0}/domain/{1}'.format(self.server, name)
return self.__get(url)

def get_domain_list(self, marker="", limit=100):
"""
获取域名信息,文档 https://developer.qiniu.com/fusion/api/4246/the-domain-name

Args:
name: 域名, 如果是泛域名,必须以点号 . 开头
Returns:
返回一个tuple对象,其格式为(<result>, <ResponseInfo>)
- result 成功返回dict{},失败返回{"error": "<errMsg string>"}
- ResponseInfo 请求的Response信息
"""
url = '{0}/domain'.format(self.server)
ret, respInfo = self.__get(url, params={"marker": marker, "limit": limit})
yield ret, respInfo

if ret.get("marker", ""):
for result in self.get_domain_list(marker=ret['marker'], limit=limit):
yield result

def put_httpsconf(self, name, certid, forceHttps):
"""
修改证书,文档 https://developer.qiniu.com/fusion/api/4246/the-domain-name#11
Expand Down