From bdf03dbfdd94fb5245a66e33e267f3b258950a08 Mon Sep 17 00:00:00 2001 From: lerdb Date: Wed, 12 Jun 2024 19:56:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DPython3.10=E4=BB=A5?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=B3=95=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/utils.py b/common/utils.py index ff000a6..931ffec 100644 --- a/common/utils.py +++ b/common/utils.py @@ -18,6 +18,7 @@ import re import xmltodict import ipaddress from urllib.parse import quote, unquote, urlparse +from typing import Union def createBase64Encode(data_bytes): encoded_data = base64.b64encode(data_bytes) @@ -65,7 +66,7 @@ def filterFileName(filename): # 将不合法字符替换为下划线 return re.sub(illegal_chars, '_', filename) -def createMD5(s: (str | bytes)): +def createMD5(s: Union[str, bytes]): if (isinstance(s, str)): s = s.encode("utf-8") return hashlib.md5(s).hexdigest()