diff --git a/README.md b/README.md index 1459c5b..2c42f78 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,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 地址 | diff --git a/dns/cloudflare.py b/dns/cloudflare.py index f464575..d4f9ffa 100644 --- a/dns/cloudflare.py +++ b/dns/cloudflare.py @@ -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() diff --git a/schema/v2.8.json b/schema/v2.8.json index e7e8ba0..07503b0 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或者邮箱" },