xtn-tools-pro 1.0.0.0.3__tar.gz → 1.0.0.0.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {xtn-tools-pro-1.0.0.0.3/xtn_tools_pro.egg-info → xtn-tools-pro-1.0.0.0.4}/PKG-INFO +1 -1
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/setup.py +1 -1
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/tools.py +32 -7
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4/xtn_tools_pro.egg-info}/PKG-INFO +1 -1
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/LICENSE +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/README.md +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/setup.cfg +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/__init__.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/db/MongoDB.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/db/RedisDB.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/db/__init__.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/proxy/XiaoXiangProxy.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/proxy/__init__.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/tools_flie.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro/tools_time.py +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro.egg-info/SOURCES.txt +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro.egg-info/dependency_links.txt +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro.egg-info/requires.txt +0 -0
- {xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro.egg-info/top_level.txt +0 -0
@@ -37,25 +37,54 @@ def get_md5_16(s, is_upper=False):
|
|
37
37
|
return result[8:24]
|
38
38
|
|
39
39
|
|
40
|
-
def
|
40
|
+
def get_binary_content_md5_32(content, is_upper=False):
|
41
|
+
"""
|
42
|
+
二进制内容md5 例如图片
|
43
|
+
:param content: 二进制内容
|
44
|
+
:param is_upper: 是否转大写 默认False
|
45
|
+
:return:
|
46
|
+
"""
|
47
|
+
md5_hash = hashlib.md5(content)
|
48
|
+
md5_hexdigest = md5_hash.hexdigest()
|
49
|
+
if is_upper:
|
50
|
+
return md5_hexdigest.upper()
|
51
|
+
return md5_hexdigest
|
52
|
+
|
53
|
+
|
54
|
+
def get_binary_content_md5_16(content, is_upper=False):
|
55
|
+
"""
|
56
|
+
二进制内容md5 例如图片
|
57
|
+
:param content: 二进制内容
|
58
|
+
:param is_upper: 是否转大写 默认False
|
59
|
+
:return:
|
60
|
+
"""
|
61
|
+
result = get_binary_content_md5_32(content, is_upper)
|
62
|
+
return result[8:24]
|
63
|
+
|
64
|
+
|
65
|
+
def get_file_md5_32(file_path, is_upper=False):
|
41
66
|
"""
|
42
67
|
获取文件md5值
|
43
68
|
:param file_path: 文件路径
|
69
|
+
:param is_upper: 是否转大写 默认False
|
44
70
|
:return:
|
45
71
|
"""
|
46
72
|
with open(file_path, 'rb') as file:
|
47
73
|
data = file.read()
|
48
74
|
md5_hash = hashlib.md5(data).hexdigest()
|
75
|
+
if is_upper:
|
76
|
+
return md5_hash.upper()
|
49
77
|
return md5_hash
|
50
78
|
|
51
79
|
|
52
|
-
def get_file_md5_16(file_path):
|
80
|
+
def get_file_md5_16(file_path, is_upper=False):
|
53
81
|
"""
|
54
82
|
获取文件md5值
|
55
83
|
:param file_path: 文件路径
|
84
|
+
:param is_upper: 是否转大写 默认False
|
56
85
|
:return:
|
57
86
|
"""
|
58
|
-
result = get_file_md5_32(file_path)
|
87
|
+
result = get_file_md5_32(file_path, is_upper)
|
59
88
|
return result[8:24]
|
60
89
|
|
61
90
|
|
@@ -100,9 +129,5 @@ def get_calculate_total_page(total, limit):
|
|
100
129
|
return total_pages
|
101
130
|
|
102
131
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
132
|
if __name__ == '__main__':
|
108
133
|
pass
|
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
|
File without changes
|
{xtn-tools-pro-1.0.0.0.3 → xtn-tools-pro-1.0.0.0.4}/xtn_tools_pro.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|