From fab97f4c541326f2f1e48fe6dd41d75c275ea428 Mon Sep 17 00:00:00 2001 From: KeyPJ Date: Tue, 19 Nov 2019 11:59:05 +0800 Subject: [PATCH 1/3] cloudflare use API Tokens,token need Permissions:Zone.Zone, Zone.DNS --- dns/cloudflare.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dns/cloudflare.py b/dns/cloudflare.py index 43752b87..f87cfca2 100644 --- a/dns/cloudflare.py +++ b/dns/cloudflare.py @@ -55,10 +55,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() From 88386d98d677266fef4c7486558cf149273e3f2b Mon Sep 17 00:00:00 2001 From: KeyPJ Date: Tue, 19 Nov 2019 12:05:26 +0800 Subject: [PATCH 2/3] md update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8388726..ce7be66c 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ python run.py -c /path/to/config.json | key | type | required | default | description | tips | | :----: | :---------: | :------: | :---------: | :--------------: | ----------------------------------------------------------------- | -| id | string | √ | 无 | api 访问 ID | cloudflare 为邮箱,
HE.net 可留空 | +| id | string | √ | 无 | api 访问 ID | cloudflare 为邮箱(使用api token可为空,但对应的token需要Zone权限),
HE.net 可留空 | | token | string | √ | 无 | api 授权 token | 也叫 secret key, **反馈粘贴时删除** | | dns | string | No | `"dnspod"` | dns 服务商 | 阿里`alidns`,
dns.com 为`dnscom`,
DNSPOD 国际版`dnspod_com`,
HE.net 为`he` | | ipv4 | array | No | `[]` | ipv4 域名列表 | 为`[]`时,不会获取和更新 IPv4 地址 | From d6bc54e896f8581a9a09a017a4f789313813c877 Mon Sep 17 00:00:00 2001 From: KeyPJ Date: Tue, 19 Nov 2019 22:23:16 +0800 Subject: [PATCH 3/3] schema update --- schema/v2.8.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schema/v2.8.json b/schema/v2.8.json index e7e8ba0b..07503b06 100644 --- a/schema/v2.8.json +++ b/schema/v2.8.json @@ -17,7 +17,10 @@ }, "id": { "$id": "/properties/id", - "type": "string", + "type": [ + "string", + "null" + ], "title": "ID or Email", "description": "DNS服务API认证的ID或者邮箱" },