ezKit 3.0.4__tar.gz → 3.0.6__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.
- {ezkit-3.0.4/ezKit.egg-info → ezkit-3.0.6}/PKG-INFO +1 -1
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit/sendemail.py +4 -2
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit/utils.py +20 -0
- {ezkit-3.0.4 → ezkit-3.0.6/ezKit.egg-info}/PKG-INFO +1 -1
- {ezkit-3.0.4 → ezkit-3.0.6}/setup.py +1 -1
- {ezkit-3.0.4 → ezkit-3.0.6}/LICENSE +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/MANIFEST.in +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/README.md +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit/__init__.py +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit/database.py +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit.egg-info/SOURCES.txt +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit.egg-info/dependency_links.txt +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit.egg-info/requires.txt +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/ezKit.egg-info/top_level.txt +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/pyproject.toml +0 -0
- {ezkit-3.0.4 → ezkit-3.0.6}/setup.cfg +0 -0
|
@@ -14,11 +14,12 @@ from . import utils
|
|
|
14
14
|
DEBUG = environ.get("DEBUG")
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class TypedSMTP(TypedDict):
|
|
17
|
+
class TypedSMTP(TypedDict, total=False):
|
|
18
18
|
"""smtp type"""
|
|
19
19
|
|
|
20
20
|
server: str
|
|
21
21
|
port: int
|
|
22
|
+
timeout: Optional[float]
|
|
22
23
|
# tls: bool
|
|
23
24
|
|
|
24
25
|
|
|
@@ -120,6 +121,7 @@ async def sendemail(
|
|
|
120
121
|
|
|
121
122
|
smtp_host = smtp.get("server")
|
|
122
123
|
smtp_port = smtp.get("port")
|
|
124
|
+
smtp_timeout = smtp.get("timeout", 10.0)
|
|
123
125
|
# smtp_tls = smtp.get("tls", False)
|
|
124
126
|
|
|
125
127
|
if not smtp_host or not smtp_port:
|
|
@@ -178,7 +180,7 @@ async def sendemail(
|
|
|
178
180
|
# ------------------------------------------------------------------------------------------
|
|
179
181
|
|
|
180
182
|
# 使用 aiomail 发送邮件
|
|
181
|
-
async with aiosmtplib.SMTP(hostname=smtp_host, port=smtp_port) as smtp_server:
|
|
183
|
+
async with aiosmtplib.SMTP(hostname=smtp_host, port=smtp_port, timeout=smtp_timeout) as smtp_server:
|
|
182
184
|
|
|
183
185
|
# if smtp_tls:
|
|
184
186
|
# await smtp_server.starttls()
|
|
@@ -244,3 +244,23 @@ def parent_dir(path: str, **kwargs) -> str | None:
|
|
|
244
244
|
logger.error(e)
|
|
245
245
|
|
|
246
246
|
return None
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
# --------------------------------------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def read_text(path: str) -> str | None:
|
|
253
|
+
"""Read Text"""
|
|
254
|
+
|
|
255
|
+
try:
|
|
256
|
+
|
|
257
|
+
return Path(path).read_text(encoding="utf-8").strip()
|
|
258
|
+
|
|
259
|
+
except Exception as e:
|
|
260
|
+
|
|
261
|
+
if DEBUG:
|
|
262
|
+
logger.exception(e)
|
|
263
|
+
else:
|
|
264
|
+
logger.error(e)
|
|
265
|
+
|
|
266
|
+
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|