Format project code
This commit is contained in:
@@ -15,12 +15,12 @@ urllib3.disable_warnings()
|
||||
|
||||
def get_response(status: int, data: Any = None, message: str = ""):
|
||||
obj = {
|
||||
'status': status,
|
||||
"status": status,
|
||||
}
|
||||
if data:
|
||||
obj['data'] = data
|
||||
obj["data"] = data
|
||||
if message:
|
||||
obj['message'] = message
|
||||
obj["message"] = message
|
||||
return obj
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ def to_json(obj):
|
||||
elif isinstance(o, (list, tuple)):
|
||||
return [serialize(item) for item in o]
|
||||
# 如果对象是自定义类型,尝试返回其__dict__属性
|
||||
elif hasattr(o, '__dict__'):
|
||||
elif hasattr(o, "__dict__"):
|
||||
return serialize(o.__dict__)
|
||||
# 其他情况返回None(或者可以选择抛出异常)
|
||||
else:
|
||||
@@ -199,7 +199,8 @@ def split_string_by_punctuations(s):
|
||||
|
||||
def md5(text):
|
||||
import hashlib
|
||||
return hashlib.md5(text.encode('utf-8')).hexdigest()
|
||||
|
||||
return hashlib.md5(text.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def get_system_locale():
|
||||
|
||||
Reference in New Issue
Block a user