mirror of
https://github.com/NewFuture/DDNS.git
synced 2026-10-19 16:15:45 +00:00
log details
This commit is contained in:
@@ -5,7 +5,7 @@ Build Status [](https://travis-ci.com/NewFuture/DDNS) | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) |
|
||||
|  | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) | [](https://dev.azure.com/NewFuture-CI/ddns-ci/_build/latest?definitionId=2&branchName=master) |
|
||||
|
||||
------------
|
||||
|
||||
|
||||
+2
-1
@@ -82,10 +82,11 @@ def request(param=None, **params):
|
||||
conn.close()
|
||||
|
||||
if response.status < 200 or response.status >= 300:
|
||||
logger.warn('%s : error:%s', action, data)
|
||||
raise Exception(data)
|
||||
else:
|
||||
data = json.loads(data.decode('utf8'))
|
||||
logger.debug(data)
|
||||
logger.debug('%s : result:%s', action, data)
|
||||
return data
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -33,7 +33,7 @@ def request(method, action, param=None, **params):
|
||||
if param:
|
||||
params.update(param)
|
||||
|
||||
logger.debug("$s %s : params:%s", action, params)
|
||||
logger.info("$s %s : params:%s", action, params)
|
||||
if PROXY:
|
||||
conn = HTTPSConnection(PROXY)
|
||||
conn.set_tunnel(API_SITE, 443)
|
||||
@@ -59,6 +59,7 @@ def request(method, action, param=None, **params):
|
||||
raise Exception(res)
|
||||
else:
|
||||
data = json.loads(res.decode('utf8'))
|
||||
logger.debug('%s : result:%s', action, data)
|
||||
if not data:
|
||||
raise Exception("Empty Response")
|
||||
elif data.get('success'):
|
||||
@@ -111,7 +112,7 @@ def update_record(domain, value, record_type="A"):
|
||||
"""
|
||||
更新记录
|
||||
"""
|
||||
logger.debug(">>>>>%s(%s)", domain, record_type)
|
||||
logger.info(">>>>>%s(%s)", domain, record_type)
|
||||
zoneid = get_zone_id(domain)
|
||||
if not zoneid:
|
||||
raise Exception("invalid domain: [ %s ] " % domain)
|
||||
|
||||
+3
-3
@@ -59,7 +59,7 @@ def request(action, param=None, **params):
|
||||
if param:
|
||||
params.update(param)
|
||||
params = signature(params)
|
||||
logger.debug("%s : params:%s", action, params)
|
||||
logger.info("%s : params:%s", action, params)
|
||||
|
||||
if PROXY:
|
||||
conn = HTTPSConnection(PROXY)
|
||||
@@ -77,9 +77,9 @@ def request(action, param=None, **params):
|
||||
raise Exception(result)
|
||||
else:
|
||||
data = json.loads(result.decode('utf8'))
|
||||
logger.debug('%s : result:%s', action, data)
|
||||
if data.get('code') != 0:
|
||||
raise Exception("api error:", data.get('message'))
|
||||
logger.debug(data)
|
||||
data = data.get('data')
|
||||
if data is None:
|
||||
raise Exception('response data is none')
|
||||
@@ -136,7 +136,7 @@ def update_record(domain, value, record_type='A'):
|
||||
"""
|
||||
更新记录
|
||||
"""
|
||||
logger.debug(">>>>>%s(%s)", domain, record_type)
|
||||
logger.info(">>>>>%s(%s)", domain, record_type)
|
||||
sub, main, domain_id = get_domain_info(domain)
|
||||
|
||||
records = get_records(main, domain_id, record=sub, type=record_type)
|
||||
|
||||
+9
-11
@@ -35,7 +35,7 @@ def request(action, param=None, **params):
|
||||
params.update(param)
|
||||
|
||||
params.update({'login_token': '***', 'format': 'json'})
|
||||
logger.debug("%s : params:%s", action, params)
|
||||
logger.info("%s : params:%s", action, params)
|
||||
params['login_token'] = "%s,%s" % (ID, TOKEN)
|
||||
|
||||
if PROXY:
|
||||
@@ -51,9 +51,11 @@ def request(action, param=None, **params):
|
||||
conn.close()
|
||||
|
||||
if response.status < 200 or response.status >= 300:
|
||||
logger.warn('%s : error:%s', action, res)
|
||||
raise Exception(res)
|
||||
else:
|
||||
data = json.loads(res.decode('utf8'))
|
||||
logger.debug('%s : result:%s', action, data)
|
||||
if not data:
|
||||
raise Exception("empty response")
|
||||
elif data.get("status", {}).get("code") == "1":
|
||||
@@ -99,15 +101,11 @@ def get_domain_id(domain):
|
||||
# 如果已经存在直接返回防止再次请求
|
||||
return get_domain_id.domain_list[domain]
|
||||
else:
|
||||
try:
|
||||
info = request('Domain.Info', domain=domain)
|
||||
except Exception:
|
||||
return
|
||||
if info and info.get('status', {}).get('code') == "1":
|
||||
did = info.get("domain", {}).get("id")
|
||||
if did:
|
||||
get_domain_id.domain_list[domain] = did
|
||||
return did
|
||||
info = request('Domain.Info', domain=domain)
|
||||
did = info.get("domain", {}).get("id")
|
||||
if did:
|
||||
get_domain_id.domain_list[domain] = did
|
||||
return did
|
||||
|
||||
|
||||
def get_records(did, **conditions):
|
||||
@@ -144,7 +142,7 @@ def update_record(domain, value, record_type="A"):
|
||||
"""
|
||||
更新记录
|
||||
"""
|
||||
logger.debug(">>>>>%s(%s)", domain, record_type)
|
||||
logger.info(">>>>>%s(%s)", domain, record_type)
|
||||
domainid, sub = get_domain_info(domain)
|
||||
if not domainid:
|
||||
raise Exception("invalid domain: [ %s ] " % domain)
|
||||
|
||||
+3
-2
@@ -35,7 +35,7 @@ def request(action, param=None, **params):
|
||||
params.update(param)
|
||||
|
||||
params.update({'login_token': '***', 'format': 'json'})
|
||||
logger.debug("%s : params:%s", action, params)
|
||||
logger.info("%s : params:%s", action, params)
|
||||
params['login_token'] = "%s,%s" % (ID, TOKEN)
|
||||
|
||||
if PROXY:
|
||||
@@ -57,6 +57,7 @@ def request(action, param=None, **params):
|
||||
raise Exception(res)
|
||||
else:
|
||||
data = json.loads(res.decode('utf8'))
|
||||
logger.debug('%s : result:%s', action, data)
|
||||
if not data:
|
||||
raise Exception("empty response")
|
||||
elif data.get("status", {}).get("code") == "1":
|
||||
@@ -142,7 +143,7 @@ def update_record(domain, value, record_type="A"):
|
||||
"""
|
||||
更新记录
|
||||
"""
|
||||
logger.debug(">>>>>%s(%s)", domain, record_type)
|
||||
logger.info(">>>>>%s(%s)", domain, record_type)
|
||||
domainid, sub = get_domain_info(domain)
|
||||
if not domainid:
|
||||
raise Exception("invalid domain: [ %s ] " % domain)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
* windows 下载 `ddns.exe`
|
||||
* Ubuntu 下载 `ddns`
|
||||
* Mac 下载 `ddns-mac.zip`解压运行
|
||||
* 其他下载 源码 python 运行
|
||||
Reference in New Issue
Block a user