mirror of
https://github.com/NewFuture/DDNS.git
synced 2026-10-21 12:03:21 +00:00
Merge pull request #113 from KeyPJ/cloudflare-use-api-token
Cloudflare use api token
This commit is contained in:
@@ -105,7 +105,7 @@ python run.py -c /path/to/config.json
|
||||
|
||||
| key | type | required | default | description | tips |
|
||||
| :----: | :---------: | :------: | :---------: | :--------------: | ----------------------------------------------------------------- |
|
||||
| id | string | √ | 无 | api 访问 ID | cloudflare 为邮箱,<br>HE.net 可留空 |
|
||||
| id | string | √ | 无 | api 访问 ID | cloudflare 为邮箱(使用api token可为空,但对应的token需要Zone权限),<br>HE.net 可留空 |
|
||||
| token | string | √ | 无 | api 授权 token | 也叫 secret key, **反馈粘贴时删除** |
|
||||
| dns | string | No | `"dnspod"` | dns 服务商 | 阿里`alidns`,<br>dns.com 为`dnscom`,<br>DNSPOD 国际版`dnspod_com`,<br>HE.net 为`he` |
|
||||
| ipv4 | array | No | `[]` | ipv4 域名列表 | 为`[]`时,不会获取和更新 IPv4 地址 |
|
||||
|
||||
+5
-4
@@ -56,10 +56,11 @@ def request(method, action, param=None, **params):
|
||||
if params:
|
||||
action += '?' + urlencode(params)
|
||||
params = None
|
||||
conn.request(method, '/client/v4/zones' + action, params,
|
||||
{"Content-type": "application/json",
|
||||
"X-Auth-Email": Config.ID,
|
||||
"X-Auth-Key": Config.TOKEN})
|
||||
if Config.ID is None:
|
||||
headers = {"Content-type": "application/json", "Authorization": "Bearer " + Config.TOKEN}
|
||||
else:
|
||||
headers = {"Content-type": "application/json", "X-Auth-Email": Config.ID, "X-Auth-Key": Config.TOKEN}
|
||||
conn.request(method, '/client/v4/zones' + action, params, headers)
|
||||
response = conn.getresponse()
|
||||
res = response.read().decode('utf8')
|
||||
conn.close()
|
||||
|
||||
+4
-1
@@ -17,7 +17,10 @@
|
||||
},
|
||||
"id": {
|
||||
"$id": "/properties/id",
|
||||
"type": "string",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"title": "ID or Email",
|
||||
"description": "DNS服务API认证的ID或者邮箱"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user