ddns 4.0.0b6__tar.gz → 4.0.0b8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ddns might be problematic. Click here for more details.

Files changed (31) hide show
  1. {ddns-4.0.0b6 → ddns-4.0.0b8}/PKG-INFO +51 -32
  2. {ddns-4.0.0b6 → ddns-4.0.0b8}/README.md +30 -10
  3. ddns-4.0.0b8/ddns/__init__.py +19 -0
  4. ddns-4.0.0b6/run.py → ddns-4.0.0b8/ddns/__main__.py +40 -50
  5. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/dnspod_com.py +1 -1
  6. ddns-4.0.0b8/ddns/util/config.py +313 -0
  7. {ddns-4.0.0b6 → ddns-4.0.0b8}/ddns.egg-info/PKG-INFO +51 -32
  8. ddns-4.0.0b8/ddns.egg-info/SOURCES.txt +25 -0
  9. ddns-4.0.0b8/ddns.egg-info/entry_points.txt +2 -0
  10. ddns-4.0.0b8/ddns.egg-info/requires.txt +4 -0
  11. ddns-4.0.0b8/ddns.egg-info/top_level.txt +1 -0
  12. ddns-4.0.0b8/pyproject.toml +114 -0
  13. {ddns-4.0.0b6 → ddns-4.0.0b8}/setup.cfg +0 -3
  14. ddns-4.0.0b6/ddns.egg-info/SOURCES.txt +0 -23
  15. ddns-4.0.0b6/ddns.egg-info/entry_points.txt +0 -2
  16. ddns-4.0.0b6/ddns.egg-info/top_level.txt +0 -3
  17. ddns-4.0.0b6/setup.py +0 -240
  18. ddns-4.0.0b6/util/config.py +0 -227
  19. {ddns-4.0.0b6 → ddns-4.0.0b8}/LICENSE +0 -0
  20. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/__init__.py +0 -0
  21. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/alidns.py +0 -0
  22. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/callback.py +0 -0
  23. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/cloudflare.py +0 -0
  24. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/dnscom.py +0 -0
  25. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/dnspod.py +0 -0
  26. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/he.py +0 -0
  27. {ddns-4.0.0b6/dns → ddns-4.0.0b8/ddns/provider}/huaweidns.py +0 -0
  28. {ddns-4.0.0b6 → ddns-4.0.0b8/ddns}/util/__init__.py +0 -0
  29. {ddns-4.0.0b6 → ddns-4.0.0b8/ddns}/util/cache.py +0 -0
  30. {ddns-4.0.0b6 → ddns-4.0.0b8/ddns}/util/ip.py +0 -0
  31. {ddns-4.0.0b6 → ddns-4.0.0b8}/ddns.egg-info/dependency_links.txt +0 -0
@@ -1,14 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddns
3
- Version: 4.0.0b6
4
- Summary: automatically update DNS records to my IP [域名自动指向本机IP]
5
- Home-page: https://ddns.newfuture.cc
6
- Author: NewFuture
7
- Author-email: python@newfuture.cc
8
- License: MIT
9
- Project-URL: Bug Reports, https://github.com/NewFuture/DDNS/issues
3
+ Version: 4.0.0b8
4
+ Summary: Dynamic DNS client for multiple providers, supporting IPv4 and IPv6.
5
+ Author-email: NewFuture <python@newfuture.cc>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://ddns.newfuture.cc
8
+ Project-URL: Documentation, https://ddns.newfuture.cc
9
+ Project-URL: Repository, https://github.com/NewFuture/DDNS
10
+ Project-URL: Bug Tracker, https://github.com/NewFuture/DDNS/issues
10
11
  Project-URL: Source, https://github.com/NewFuture/DDNS
11
- Keywords: ddns ipv6 ipv4 dns dnspod alidns cloudflare
12
+ Keywords: ddns,ipv6,ipv4,dns,dnspod,alidns,cloudflare
12
13
  Platform: any
13
14
  Classifier: Development Status :: 5 - Production/Stable
14
15
  Classifier: Intended Audience :: Developers
@@ -19,27 +20,25 @@ Classifier: Topic :: Internet
19
20
  Classifier: Topic :: Internet :: Name Service (DNS)
20
21
  Classifier: Topic :: System :: Networking
21
22
  Classifier: Topic :: Software Development
22
- Classifier: License :: OSI Approved :: MIT License
23
23
  Classifier: Programming Language :: Python :: 2.7
24
24
  Classifier: Programming Language :: Python :: 3
25
- Requires-Python: >=2.5, <4
25
+ Classifier: Programming Language :: Python :: 3.6
26
+ Classifier: Programming Language :: Python :: 3.7
27
+ Classifier: Programming Language :: Python :: 3.8
28
+ Classifier: Programming Language :: Python :: 3.9
29
+ Classifier: Programming Language :: Python :: 3.10
30
+ Classifier: Programming Language :: Python :: 3.11
31
+ Classifier: Programming Language :: Python :: 3.12
32
+ Classifier: Programming Language :: Python :: 3.13
33
+ Requires-Python: >=2.7
26
34
  Description-Content-Type: text/markdown
27
35
  License-File: LICENSE
28
- Dynamic: author
29
- Dynamic: author-email
30
- Dynamic: classifier
31
- Dynamic: description
32
- Dynamic: description-content-type
33
- Dynamic: home-page
34
- Dynamic: keywords
35
- Dynamic: license
36
+ Provides-Extra: dev
37
+ Requires-Dist: black; extra == "dev"
38
+ Requires-Dist: flake8; extra == "dev"
36
39
  Dynamic: license-file
37
- Dynamic: platform
38
- Dynamic: project-url
39
- Dynamic: requires-python
40
- Dynamic: summary
41
40
 
42
- # [<img src="doc/img/ddns.svg" width="32px" height="32px"/>](https://ddns.newfuture.cc) [DDNS](https://github.com/NewFuture/DDNS)
41
+ # [<img src="https://ddns.newfuture.cc/doc/img/ddns.svg" width="32px" height="32px"/>](https://ddns.newfuture.cc) [DDNS](https://github.com/NewFuture/DDNS)
43
42
 
44
43
  > 自动更新 DNS 解析 到本机 IP 地址,支持 IPv4 和 IPv6,本地(内网)IP 和公网 IP。
45
44
  > 代理模式,支持自动创建 DNS 记录。
@@ -60,9 +59,9 @@ Dynamic: summary
60
59
  - [二进制文件](https://github.com/NewFuture/DDNS/releases/latest) ![cross platform](https://img.shields.io/badge/system-windows_%7C%20linux_%7C%20mac-success.svg?style=social)
61
60
 
62
61
  - 配置方式:
63
- - [命令行参数](#详细配置)
64
- - [JSON 配置文件](#详细配置)
65
- - [环境变量配置](doc/env.md) 📖
62
+ - [命令行参数](https://ddns.newfuture.cc/doc/cli.html)
63
+ - [JSON 配置文件](https://ddns.newfuture.cc/doc/json.html)
64
+ - [环境变量配置](https://ddns.newfuture.cc/doc/env.html)
66
65
 
67
66
  - 域名支持:
68
67
  - 多个域名支持
@@ -138,6 +137,8 @@ Dynamic: summary
138
137
  newfuture/ddns
139
138
  ```
140
139
 
140
+ 更多详细说明和高级用法请查看 [Docker 使用文档](doc/docker.md)。
141
+
141
142
  ### ② 快速配置
142
143
 
143
144
  1. 申请 api `token`,填写到对应的 `id` 和 `token` 字段:
@@ -155,12 +156,27 @@ Dynamic: summary
155
156
 
156
157
  ## 详细配置
157
158
 
158
- 所有字段可通过三种方式进行配置
159
+ 所有字段可通过三种方式进行配置,优先级为:**命令行参数 > JSON配置文件 > 环境变量**
159
160
 
160
- 1. 命令行参数 `ddns --key=value`(`ddns -h` 查看详情),优先级最高
161
- 2. JSON 配置文件(值为 null 认为是有效值,会覆盖环境变量的设置,如果没有对应的 key 则会尝试使用环境变量)
161
+ 1. [命令行参数](doc/cli.md) `ddns --key=value`(`ddns -h` 查看详情),优先级最高
162
+ 2. [JSON 配置文件](doc/json.md)(值为 null 认为是有效值,会覆盖环境变量的设置,如果没有对应的 key 则会尝试使用环境变量)
162
163
  3. 环境变量 DDNS_ 前缀加上 key 全大写或者全小写,点转下划线(`${ddns_id}` 或 `${DDNS_ID}`,`${DDNS_LOG_LEVEL}`)
163
164
 
165
+ ### 配置优先级和字段覆盖关系
166
+
167
+ 如果同一个配置项在多个地方设置,将按照以下优先级规则生效:
168
+
169
+ - **命令行参数**:优先级最高,会覆盖其他所有设置
170
+ - **JSON配置文件**:介于命令行和环境变量之间,会覆盖环境变量中的设置
171
+ - **环境变量**:优先级最低,当其他方式未设置时使用
172
+
173
+ **特殊情况**:
174
+ - JSON配置中明确设为`null`的值会覆盖环境变量设置
175
+ - `debug`参数只在命令行中有效,JSON配置文件中的同名设置无效
176
+ - 多值参数(如`ipv4`、`ipv6`等)在命令行中使用方式为重复使用参数,如`--ipv4 domain1 --ipv4 domain2`
177
+
178
+ 各配置方式的详细说明请查看对应文档:[命令行](doc/cli.md)、[JSON配置](doc/json.md)、[环境变量](doc/env.md)
179
+
164
180
  > 📖 **环境变量详细配置**: 查看 [环境变量配置文档](doc/env.md) 了解所有环境变量的详细用法和示例
165
181
 
166
182
  <details open>
@@ -169,6 +185,7 @@ Dynamic: summary
169
185
  - 首次运行会自动生成一个模板配置文件
170
186
  - 可以使用 `-c` 使用指定的配置文件(默认读取当前目录的 config.json)
171
187
  - 推荐使用 vscode 等支持 JsonSchema 的编辑器编辑配置文件
188
+ - 查看 [JSON配置文件详细文档](doc/json.md) 了解完整的配置选项和示例
172
189
 
173
190
  ```bash
174
191
  ddns -c path/to/config.json
@@ -189,9 +206,9 @@ python run.py -c /path/to/config.json
189
206
  | index6 | string\|int\|array | No | `"default"` | ipv6 获取方式 | 可设置 `网卡`、`内网`、`公网`、`正则` 等方式 |
190
207
  | ttl | number | No | `null` | DNS 解析 TTL 时间 | 不设置采用 DNS 默认策略 |
191
208
  | proxy | string\|array | No | 无 | http 代理 `;` 分割 | 多代理逐个尝试直到成功,`DIRECT` 为直连 |
192
- | ~~debug~~| bool | No | `false` | 是否开启调试 | v4 中弃用,请改用 log.level=DEBUG |
209
+ | debug | bool | No | `false` | 是否开启调试 | 等同于设置 log.level=DEBUG,仅命令行参数`--debug`有效 |
193
210
  | cache | string\|bool | No | `true` | 是否缓存记录 | 正常情况打开避免频繁更新,默认位置为临时目录下 `ddns.cache`,也可以指定一个具体路径 |
194
- | log | {"level":string,"file":string} | No | `null` | 日志配置(可选) | 日志配置,日志级别和路径(默认命令行),例如:`{ "level": "DEBUG", "file": "dns.log" }` |
211
+ | log | object | No | `null` | 日志配置(可选) | 日志配置对象,支持`level`、`file`、`format`、`datefmt`参数 |
195
212
 
196
213
  #### index4 和 index6 参数说明
197
214
 
@@ -237,7 +254,9 @@ python run.py -c /path/to/config.json
237
254
  "proxy": "127.0.0.1:1080;DIRECT",
238
255
  "log": {
239
256
  "level": "DEBUG",
240
- "file": "dns.log"
257
+ "file": "dns.log",
258
+ "format": "%(asctime)s %(levelname)s [%(module)s]: %(message)s",
259
+ "datefmt": "%Y-%m-%dT%H:%M:%S"
241
260
  }
242
261
  }
243
262
  ```
@@ -1,4 +1,4 @@
1
- # [<img src="doc/img/ddns.svg" width="32px" height="32px"/>](https://ddns.newfuture.cc) [DDNS](https://github.com/NewFuture/DDNS)
1
+ # [<img src="https://ddns.newfuture.cc/doc/img/ddns.svg" width="32px" height="32px"/>](https://ddns.newfuture.cc) [DDNS](https://github.com/NewFuture/DDNS)
2
2
 
3
3
  > 自动更新 DNS 解析 到本机 IP 地址,支持 IPv4 和 IPv6,本地(内网)IP 和公网 IP。
4
4
  > 代理模式,支持自动创建 DNS 记录。
@@ -19,9 +19,9 @@
19
19
  - [二进制文件](https://github.com/NewFuture/DDNS/releases/latest) ![cross platform](https://img.shields.io/badge/system-windows_%7C%20linux_%7C%20mac-success.svg?style=social)
20
20
 
21
21
  - 配置方式:
22
- - [命令行参数](#详细配置)
23
- - [JSON 配置文件](#详细配置)
24
- - [环境变量配置](doc/env.md) 📖
22
+ - [命令行参数](https://ddns.newfuture.cc/doc/cli.html)
23
+ - [JSON 配置文件](https://ddns.newfuture.cc/doc/json.html)
24
+ - [环境变量配置](https://ddns.newfuture.cc/doc/env.html)
25
25
 
26
26
  - 域名支持:
27
27
  - 多个域名支持
@@ -97,6 +97,8 @@
97
97
  newfuture/ddns
98
98
  ```
99
99
 
100
+ 更多详细说明和高级用法请查看 [Docker 使用文档](doc/docker.md)。
101
+
100
102
  ### ② 快速配置
101
103
 
102
104
  1. 申请 api `token`,填写到对应的 `id` 和 `token` 字段:
@@ -114,12 +116,27 @@
114
116
 
115
117
  ## 详细配置
116
118
 
117
- 所有字段可通过三种方式进行配置
119
+ 所有字段可通过三种方式进行配置,优先级为:**命令行参数 > JSON配置文件 > 环境变量**
118
120
 
119
- 1. 命令行参数 `ddns --key=value`(`ddns -h` 查看详情),优先级最高
120
- 2. JSON 配置文件(值为 null 认为是有效值,会覆盖环境变量的设置,如果没有对应的 key 则会尝试使用环境变量)
121
+ 1. [命令行参数](doc/cli.md) `ddns --key=value`(`ddns -h` 查看详情),优先级最高
122
+ 2. [JSON 配置文件](doc/json.md)(值为 null 认为是有效值,会覆盖环境变量的设置,如果没有对应的 key 则会尝试使用环境变量)
121
123
  3. 环境变量 DDNS_ 前缀加上 key 全大写或者全小写,点转下划线(`${ddns_id}` 或 `${DDNS_ID}`,`${DDNS_LOG_LEVEL}`)
122
124
 
125
+ ### 配置优先级和字段覆盖关系
126
+
127
+ 如果同一个配置项在多个地方设置,将按照以下优先级规则生效:
128
+
129
+ - **命令行参数**:优先级最高,会覆盖其他所有设置
130
+ - **JSON配置文件**:介于命令行和环境变量之间,会覆盖环境变量中的设置
131
+ - **环境变量**:优先级最低,当其他方式未设置时使用
132
+
133
+ **特殊情况**:
134
+ - JSON配置中明确设为`null`的值会覆盖环境变量设置
135
+ - `debug`参数只在命令行中有效,JSON配置文件中的同名设置无效
136
+ - 多值参数(如`ipv4`、`ipv6`等)在命令行中使用方式为重复使用参数,如`--ipv4 domain1 --ipv4 domain2`
137
+
138
+ 各配置方式的详细说明请查看对应文档:[命令行](doc/cli.md)、[JSON配置](doc/json.md)、[环境变量](doc/env.md)
139
+
123
140
  > 📖 **环境变量详细配置**: 查看 [环境变量配置文档](doc/env.md) 了解所有环境变量的详细用法和示例
124
141
 
125
142
  <details open>
@@ -128,6 +145,7 @@
128
145
  - 首次运行会自动生成一个模板配置文件
129
146
  - 可以使用 `-c` 使用指定的配置文件(默认读取当前目录的 config.json)
130
147
  - 推荐使用 vscode 等支持 JsonSchema 的编辑器编辑配置文件
148
+ - 查看 [JSON配置文件详细文档](doc/json.md) 了解完整的配置选项和示例
131
149
 
132
150
  ```bash
133
151
  ddns -c path/to/config.json
@@ -148,9 +166,9 @@ python run.py -c /path/to/config.json
148
166
  | index6 | string\|int\|array | No | `"default"` | ipv6 获取方式 | 可设置 `网卡`、`内网`、`公网`、`正则` 等方式 |
149
167
  | ttl | number | No | `null` | DNS 解析 TTL 时间 | 不设置采用 DNS 默认策略 |
150
168
  | proxy | string\|array | No | 无 | http 代理 `;` 分割 | 多代理逐个尝试直到成功,`DIRECT` 为直连 |
151
- | ~~debug~~| bool | No | `false` | 是否开启调试 | v4 中弃用,请改用 log.level=DEBUG |
169
+ | debug | bool | No | `false` | 是否开启调试 | 等同于设置 log.level=DEBUG,仅命令行参数`--debug`有效 |
152
170
  | cache | string\|bool | No | `true` | 是否缓存记录 | 正常情况打开避免频繁更新,默认位置为临时目录下 `ddns.cache`,也可以指定一个具体路径 |
153
- | log | {"level":string,"file":string} | No | `null` | 日志配置(可选) | 日志配置,日志级别和路径(默认命令行),例如:`{ "level": "DEBUG", "file": "dns.log" }` |
171
+ | log | object | No | `null` | 日志配置(可选) | 日志配置对象,支持`level`、`file`、`format`、`datefmt`参数 |
154
172
 
155
173
  #### index4 和 index6 参数说明
156
174
 
@@ -196,7 +214,9 @@ python run.py -c /path/to/config.json
196
214
  "proxy": "127.0.0.1:1080;DIRECT",
197
215
  "log": {
198
216
  "level": "DEBUG",
199
- "file": "dns.log"
217
+ "file": "dns.log",
218
+ "format": "%(asctime)s %(levelname)s [%(module)s]: %(message)s",
219
+ "datefmt": "%Y-%m-%dT%H:%M:%S"
200
220
  }
201
221
  }
202
222
  ```
@@ -0,0 +1,19 @@
1
+ # -*- coding:utf-8 -*-
2
+ """
3
+ ddns Package
4
+ """
5
+
6
+ __description__ = "automatically update DNS records to my IP [域名自动指向本机IP]"
7
+
8
+ # 编译时,版本会被替换
9
+ __version__ = "4.0.0b8"
10
+
11
+ # 时间也会被替换掉
12
+ build_date = "2025-06-19T10:36:16Z"
13
+
14
+ __doc__ = """
15
+ ddns[{}@{}]
16
+ (i) homepage or docs [文档主页]: https://ddns.newfuture.cc/
17
+ (?) issues or bugs [问题和反馈]: https://github.com/NewFuture/DDNS/issues
18
+ Copyright (c) New Future (MIT License)
19
+ """.format(__version__, build_date)
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env python
2
1
  # -*- coding:utf-8 -*-
3
2
  """
4
3
  DDNS
@@ -10,24 +9,16 @@ from os import path, environ, name as os_name
10
9
  from io import TextIOWrapper
11
10
  from subprocess import check_output
12
11
  from tempfile import gettempdir
13
- from logging import basicConfig, info, warning, error, debug
12
+ from logging import basicConfig, info, warning, error, debug, DEBUG, NOTSET
14
13
 
15
14
  import sys
16
15
 
17
- from util import ip
18
- from util.cache import Cache
19
- from util.config import init_config, get_config
16
+ from .__init__ import __version__, __description__, __doc__, build_date
17
+ from .util import ip
18
+ from .util.cache import Cache
19
+ from .util.config import init_config, get_config
20
20
 
21
- __version__ = "v4.0.0-beta6@2025-06-12T17:22:06+00:00" # CI 时会被Tag替换
22
- __description__ = "automatically update DNS records to my IP [域名自动指向本机IP]"
23
- __doc__ = """
24
- ddns[%s]
25
- (i) homepage or docs [文档主页]: https://ddns.newfuture.cc/
26
- (?) issues or bugs [问题和帮助]: https://github.com/NewFuture/DDNS/issues
27
- Copyright (c) New Future (MIT License)
28
- """ % (__version__)
29
-
30
- environ["DDNS_VERSION"] = "v4.0.0-beta6"
21
+ environ["DDNS_VERSION"] = __version__
31
22
 
32
23
 
33
24
  def is_false(value):
@@ -99,44 +90,62 @@ def update_ip(ip_type, cache, dns, proxy_list):
99
90
  if not domains:
100
91
  return None
101
92
  if not isinstance(domains, list):
102
- domains = domains.strip('; ').replace(
103
- ',', ';').replace(' ', ';').split(';')
104
- index_rule = get_config('index' + ip_type, "default") # 从配置中获取index配置
93
+ domains = domains.strip('; ').replace(',', ';').replace(' ', ';').split(';')
94
+
95
+ index_rule = get_config('index' + ip_type, "default")
105
96
  address = get_ip(ip_type, index_rule)
106
97
  if not address:
107
98
  error('Fail to get %s address!', ipname)
108
99
  return False
109
- elif cache and (address == cache[ipname]):
100
+
101
+ if cache and (address == cache.get(ipname)):
110
102
  info('%s address not changed, using cache.', ipname)
111
103
  return True
112
- record_type = (ip_type == '4') and 'A' or 'AAAA'
113
- update_fail = False # https://github.com/NewFuture/DDNS/issues/16
104
+
105
+ record_type = 'A' if ip_type == '4' else 'AAAA'
106
+ update_success = False
114
107
  for domain in domains:
115
- domain = domain.lower() # https://github.com/NewFuture/DDNS/issues/431
108
+ domain = domain.lower()
116
109
  if change_dns_record(dns, proxy_list, domain=domain, ip=address, record_type=record_type):
117
- update_fail = True
118
- if cache is not False:
119
- # 如果更新失败删除缓存
120
- cache[ipname] = update_fail and address
110
+ update_success = True
111
+
112
+ if isinstance(cache, dict):
113
+ cache[ipname] = update_success and address
114
+
115
+ return update_success
121
116
 
122
117
 
123
118
  def main():
124
119
  """
125
120
  更新
126
121
  """
127
- init_config(__description__, __doc__, __version__)
122
+ encode = sys.stdout.encoding
123
+ if encode is not None and encode.lower() != 'utf-8' and hasattr(sys.stdout, 'buffer'):
124
+ # 兼容windows 和部分ASCII编码的老旧系统
125
+ sys.stdout = TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
126
+ sys.stderr = TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
127
+ init_config(__description__, __doc__, __version__, build_date)
128
128
 
129
+ log_level = get_config('log.level')
130
+ log_format = get_config('log.format', '%(asctime)s %(levelname)s [%(module)s]: %(message)s')
131
+ # Override log format in debug mode to include filename and line number for detailed debugging
132
+ if (log_level == DEBUG or log_level == NOTSET) and not log_format:
133
+ log_format = '%(asctime)s %(levelname)s [%(filename)s:%(lineno)d]: %(message)s'
129
134
  basicConfig(
130
- level=get_config('log.level'),
131
- format='%(asctime)s [%(levelname)s] %(message)s',
132
- datefmt='%m-%d %H:%M:%S',
135
+ level=log_level,
136
+ format=log_format,
137
+ datefmt=get_config('log.datefmt', '%Y-%m-%dT%H:%M:%S'),
133
138
  filename=get_config('log.file'),
134
139
  )
140
+
135
141
  info("DDNS[ %s ] run: %s %s", __version__, os_name, sys.platform)
136
142
 
137
143
  # Dynamically import the dns module as configuration
138
144
  dns_provider = str(get_config('dns', 'dnspod').lower())
139
- dns = getattr(__import__('dns', fromlist=[dns_provider]), dns_provider)
145
+ # dns_module = __import__(
146
+ # '.dns', fromlist=[dns_provider], package=__package__)
147
+ dns = getattr(__import__('ddns.provider', fromlist=[dns_provider]), dns_provider)
148
+ # dns = getattr(dns_module, dns_provider)
140
149
  dns.Config.ID = get_config('id')
141
150
  dns.Config.TOKEN = get_config('token')
142
151
  dns.Config.TTL = get_config('ttl')
@@ -168,23 +177,4 @@ def main():
168
177
 
169
178
 
170
179
  if __name__ == '__main__':
171
- encode = sys.stdout.encoding
172
- if encode is not None and encode.lower() != 'utf-8' and hasattr(sys.stdout, 'buffer'):
173
- # 兼容windows 和部分ASCII编码的老旧系统
174
- sys.stdout = TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
175
- sys.stderr = TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
176
180
  main()
177
-
178
- # Nuitka Project Configuration
179
- # nuitka-project: --mode=onefile
180
- # nuitka-project: --output-filename=ddns
181
- # nuitka-project: --product-name=DDNS
182
- # nuitka-project: --product-version=0.0.0
183
- # nuitka-project: --onefile-tempdir-spec="{TEMP}/{PRODUCT}_{VERSION}"
184
- # nuitka-project: --no-deployment-flag=self-execution
185
- # nuitka-project: --company-name="New Future"
186
- # nuitka-project: --copyright=https://ddns.newfuture.cc
187
- # nuitka-project: --assume-yes-for-downloads
188
- # nuitka-project: --python-flag=no_site,no_asserts,no_docstrings,isolated,static_hashes
189
- # nuitka-project: --nofollow-import-to=tkinter,unittest,pydoc,doctest,distutils,setuptools,lib2to3,test,idlelib,lzma
190
- # nuitka-project: --noinclude-dlls=liblzma.*
@@ -6,7 +6,7 @@ http://www.dnspod.com/docs/domains.html
6
6
  @author: New Future
7
7
  """
8
8
 
9
- from dns.dnspod import * # noqa: F403
9
+ from .dnspod import * # noqa: F403
10
10
 
11
11
  API.SITE = "api.dnspod.com" # noqa: F405
12
12
  API.DEFAULT = "default" # noqa: F405