smartpush 1.1.0__py3-none-any.whl → 1.1.3__py3-none-any.whl
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.
- smartpush/export/basic/ExcelExportChecker.py +89 -168
- smartpush/export/basic/ReadExcel.py +116 -0
- smartpush/test.py +7 -17
- {smartpush-1.1.0.dist-info → smartpush-1.1.3.dist-info}/METADATA +1 -1
- {smartpush-1.1.0.dist-info → smartpush-1.1.3.dist-info}/RECORD +7 -6
- {smartpush-1.1.0.dist-info → smartpush-1.1.3.dist-info}/WHEEL +0 -0
- {smartpush-1.1.0.dist-info → smartpush-1.1.3.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import re
|
3
|
-
import warnings
|
4
|
-
from io import BytesIO
|
1
|
+
import json
|
5
2
|
from urllib.parse import unquote
|
6
|
-
|
7
|
-
from
|
3
|
+
|
4
|
+
from smartpush.export.basic.ReadExcel import *
|
8
5
|
|
9
6
|
"""
|
10
7
|
用于excel校验
|
@@ -12,139 +9,6 @@ from requests import request
|
|
12
9
|
warnings.simplefilter("ignore")
|
13
10
|
|
14
11
|
|
15
|
-
def read_excel_from_oss(url="", method="get"):
|
16
|
-
"""读取oss的excel内容并写入到本地csv"""
|
17
|
-
try:
|
18
|
-
result = request(method=method, url=url)
|
19
|
-
excel_data = BytesIO(result.content)
|
20
|
-
print(f"成功读取oss文件内容: {url}")
|
21
|
-
return excel_data
|
22
|
-
except Exception as e:
|
23
|
-
print(f"读取oss报错 {url} 时出错:{e}")
|
24
|
-
|
25
|
-
|
26
|
-
def read_excel_data(excel_data, **kwargs):
|
27
|
-
with warnings.catch_warnings():
|
28
|
-
warnings.filterwarnings("ignore", category=UserWarning, module=re.escape('openpyxl.styles.stylesheet'))
|
29
|
-
dfs = pd.read_excel(excel_data, sheet_name=None, engine="openpyxl", na_filter=False, **kwargs)
|
30
|
-
return dfs
|
31
|
-
|
32
|
-
|
33
|
-
def read_excel_and_write_to_dict(excel_data=None, file_name=None, **kwargs):
|
34
|
-
"""excel内容并写入到内存dict中
|
35
|
-
:param excel_data:excel的io对象, 参数和file_name互斥
|
36
|
-
:file_name: excel文件名称,目前读取check_file目录下文件,参数和excel_data互斥
|
37
|
-
"""
|
38
|
-
try:
|
39
|
-
if excel_data is not None and file_name is not None:
|
40
|
-
pass
|
41
|
-
elif file_name is not None:
|
42
|
-
excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
|
43
|
-
dfs = read_excel_data(excel_data)
|
44
|
-
# 将DataFrame转换为字典,以行为单位存储数据
|
45
|
-
row_dict = {} # 创建一个空字典来存储按行转换的数据
|
46
|
-
for index, row in dfs.iterrows(): # 遍历DataFrame中的每一行
|
47
|
-
row_dict[index] = row.to_dict() # 将每一行转换为字典并存储在row_dict中
|
48
|
-
return row_dict
|
49
|
-
except Exception as e:
|
50
|
-
print(f"excel写入dict时出错:{e}")
|
51
|
-
|
52
|
-
|
53
|
-
def read_excel_and_write_to_list(excel_data=None, sheet_name=None, file_name=None, **kwargs):
|
54
|
-
"""excel内容并写入到内存list中
|
55
|
-
:param excel_data:excel的io对象, 参数和file_name互斥
|
56
|
-
:file_name: excel文件名称,目前读取check_file目录下文件,参数和excel_data互斥
|
57
|
-
|
58
|
-
io:可以是文件路径、文件对象或 ExcelFile 对象,代表要读取的 Excel 文件。
|
59
|
-
sheet_name:指定要读取的工作表,默认为第一个工作表(索引为 0)。
|
60
|
-
header:指定哪一行作为列名,默认为第一行(索引为 0)。
|
61
|
-
names:可以为列提供自定义名称,如果设置了这个,会覆盖文件中的列名。
|
62
|
-
index_col:可以指定某一列或多列作为索引。
|
63
|
-
usecols:可以指定要读取的列,可以是列的索引、列名或一个筛选函数。
|
64
|
-
dtype:可以指定数据类型,控制数据的类型转换。
|
65
|
-
engine:指定使用的 Excel 引擎,比如 xlrd、openpyxl 等。
|
66
|
-
converters:可以为不同的列指定自定义的转换函数,以字典形式存储。
|
67
|
-
true_values 和 false_values:定义哪些值会被视为 True 或 False。
|
68
|
-
skiprows:可以指定要跳过的行,可以是一个整数序列、一个整数或一个函数。
|
69
|
-
nrows:可以指定要读取的行数。
|
70
|
-
na_values:可以指定哪些值会被视为 NaN。
|
71
|
-
keep_default_na:决定是否使用默认的 NaN 值。
|
72
|
-
na_filter:决定是否过滤 NaN 值。
|
73
|
-
verbose:决定是否输出详细信息。
|
74
|
-
parse_dates:决定是否解析日期,可以是一个列表、字典或布尔值。
|
75
|
-
date_parser:自定义的日期解析函数。
|
76
|
-
date_format:日期的格式设置。
|
77
|
-
thousands:千位分隔符。
|
78
|
-
decimal:小数点分隔符。
|
79
|
-
comment:注释字符,以该字符开头的行将被跳过。
|
80
|
-
skipfooter:指定要跳过的文件末尾的行数。
|
81
|
-
storage_options:存储选项。
|
82
|
-
dtype_backend:数据类型后端。
|
83
|
-
engine_kwargs:传递给引擎的额外参数。
|
84
|
-
@param sheet_name:
|
85
|
-
|
86
|
-
|
87
|
-
"""
|
88
|
-
try:
|
89
|
-
if excel_data is not None and file_name is not None:
|
90
|
-
pass
|
91
|
-
elif file_name is not None:
|
92
|
-
excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
|
93
|
-
|
94
|
-
dfs = read_excel_data(excel_data)
|
95
|
-
rows_list = []
|
96
|
-
# 多sheet处理
|
97
|
-
for name, df in dfs.items():
|
98
|
-
rows_list.append(df.values.tolist())
|
99
|
-
if len(dfs) <= 1:
|
100
|
-
rows_list = rows_list[0]
|
101
|
-
return rows_list
|
102
|
-
except Exception as e:
|
103
|
-
print(f"excel写入list时出错:{e}")
|
104
|
-
|
105
|
-
|
106
|
-
def read_excel_and_write_to_csv(excel_data, file_name, **kwargs):
|
107
|
-
"""excel内容并写入到csv中"""
|
108
|
-
try:
|
109
|
-
df = pd.read_excel(excel_data, engine="openpyxl")
|
110
|
-
local_csv_path = os.path.join(os.path.dirname(os.getcwd()) + "/temp_file/" + file_name)
|
111
|
-
df.to_csv(local_csv_path, index=False, **kwargs)
|
112
|
-
return local_csv_path
|
113
|
-
except Exception as e:
|
114
|
-
print(f"excel写入csv时出错:{e}")
|
115
|
-
|
116
|
-
|
117
|
-
def read_excel_data_for_oss_write_to_dict(oss, **kwargs) -> dict:
|
118
|
-
"""
|
119
|
-
1、根据oss link 直接读出 dict-list
|
120
|
-
2、支持多sheet,默认sheet_name =None查全部
|
121
|
-
3、返回dict结构 {'sheet_name':[rows_list]}
|
122
|
-
"""
|
123
|
-
try:
|
124
|
-
dfs = read_excel_data(read_excel_from_oss(oss))
|
125
|
-
result = {}
|
126
|
-
for sheet_name, df in dfs.items():
|
127
|
-
rows_list = df.values.tolist()
|
128
|
-
result[sheet_name] = rows_list
|
129
|
-
return result
|
130
|
-
except Exception as e:
|
131
|
-
print(f"excel生成dict出错:{e}")
|
132
|
-
|
133
|
-
|
134
|
-
def read_excel_header_for_oss_write_to_list(oss) -> list:
|
135
|
-
"""
|
136
|
-
1、根据oss link 直接读出excel的头列 list
|
137
|
-
"""
|
138
|
-
try:
|
139
|
-
dfs = read_excel_data(read_excel_from_oss(oss))
|
140
|
-
result = []
|
141
|
-
for sheet_name, df in dfs.items():
|
142
|
-
result.append(df.keys().values.tolist())
|
143
|
-
return result
|
144
|
-
except Exception as e:
|
145
|
-
print(f"excel生成header-dict出错:{e}")
|
146
|
-
|
147
|
-
|
148
12
|
def check_excel(check_type="content", **kwargs):
|
149
13
|
"""对比excel
|
150
14
|
:param: type: 需要对比类型,
|
@@ -170,7 +34,8 @@ def check_excel(check_type="content", **kwargs):
|
|
170
34
|
expected_content = read_excel_and_write_to_list(excel_data=read_excel_from_oss(url=kwargs["expected_oss"]))
|
171
35
|
flag1, content_result = check_excel_content(actual=actual_content, expected=expected_content)
|
172
36
|
flag2, name_result = check_excel_name(actual_oss=kwargs["actual_oss"], expected_oss=kwargs["expected_oss"])
|
173
|
-
|
37
|
+
flag3, header_result = check_excel_header(actual=actual_content, expected=expected_content)
|
38
|
+
return all([flag1, flag2, flag3]), {"文件名称": name_result, "导出内容": content_result, "表头比较:": header_result}
|
174
39
|
else:
|
175
40
|
return False, f"不支持此类型: {check_type}"
|
176
41
|
except Exception as e:
|
@@ -181,13 +46,10 @@ def check_excel(check_type="content", **kwargs):
|
|
181
46
|
# 定义比较类型和对应处理函数的映射
|
182
47
|
comparison_functions = {
|
183
48
|
# 内容
|
184
|
-
"content": lambda kwargs: check_excel_content(kwargs["actual"], kwargs[
|
185
|
-
"expected"])
|
186
|
-
if "actual" in kwargs and "expected" in kwargs
|
187
|
-
else check_excel_content(kwargs["actual_oss"], kwargs["expected_oss"]),
|
49
|
+
"content": lambda kwargs: check_excel_content(kwargs["actual"], kwargs["expected"]),
|
188
50
|
# excelName
|
189
51
|
"excelName": lambda kwargs: check_excel_name(kwargs["actual_oss"], kwargs["expected_oss"]),
|
190
|
-
'header': lambda kwargs: check_excel_header(kwargs["
|
52
|
+
'header': lambda kwargs: check_excel_header(kwargs["actual"], kwargs["expected"]),
|
191
53
|
# 全部
|
192
54
|
"all": lambda kwargs: check_excel_all(kwargs["actual_oss"], kwargs["expected_oss"])
|
193
55
|
}
|
@@ -219,10 +81,20 @@ def check_excel_for_lu(check_type="content", **kwargs):
|
|
219
81
|
return False, [str(e)]
|
220
82
|
|
221
83
|
|
222
|
-
def
|
223
|
-
"""
|
224
|
-
|
225
|
-
|
84
|
+
def check_excel_content_form_dict(actual, expected):
|
85
|
+
"""
|
86
|
+
通过 OSS URL 比较 Excel 内容,支持多sheet并且包含表头
|
87
|
+
"""
|
88
|
+
expected, actual = read_excel_and_write_to_dict(actual), read_excel_and_write_to_dict(
|
89
|
+
expected)
|
90
|
+
return check_excel_content(actual=actual, expected=expected)
|
91
|
+
|
92
|
+
|
93
|
+
def check_excel_content_form_list(actual, expected):
|
94
|
+
"""
|
95
|
+
通过 内容 比较 Excel 内容,不包含表头
|
96
|
+
"""
|
97
|
+
expected, actual = read_excel_and_write_to_list(actual), read_excel_and_write_to_list(expected)
|
226
98
|
return check_excel_content(actual=actual, expected=expected)
|
227
99
|
|
228
100
|
|
@@ -230,10 +102,13 @@ def check_excel_all(actual_oss, expected_oss):
|
|
230
102
|
"""
|
231
103
|
校验所有内容
|
232
104
|
"""
|
233
|
-
|
105
|
+
expected, actual = read_excel_from_oss(expected_oss), read_excel_from_oss(actual_oss)
|
106
|
+
flag1, content_result = check_excel_content_form_dict(actual, expected)
|
234
107
|
flag2, name_result = check_excel_name(actual_oss, expected_oss)
|
235
|
-
flag3 =
|
236
|
-
return all([flag1, flag2, flag3]), {"
|
108
|
+
flag3, header_result = check_excel_header(actual, expected)
|
109
|
+
return all([flag1, flag2, flag3]), json.dumps({f"文件名称-{flag1}": name_result, f"导出内容-{flag2}": content_result,
|
110
|
+
f"表头校验-{flag3}": header_result},
|
111
|
+
ensure_ascii=False)
|
237
112
|
|
238
113
|
|
239
114
|
def check_excel_name(actual_oss, expected_oss):
|
@@ -258,7 +133,6 @@ def check_excel_content(actual, expected):
|
|
258
133
|
:param expected:预期内容:list或dict类型
|
259
134
|
"""
|
260
135
|
try:
|
261
|
-
# TODO 嵌套list -dict 比较失败
|
262
136
|
if actual == expected:
|
263
137
|
return True, ["excel内容-完全匹配"]
|
264
138
|
else:
|
@@ -271,35 +145,51 @@ def check_excel_content(actual, expected):
|
|
271
145
|
errors.append("excel内容-预期和实际行数相等,为" + str(actual_num) + "行")
|
272
146
|
else:
|
273
147
|
errors.append(
|
274
|
-
"excel内容-行数和预期对比差" + check_row.__str__() + "行" + ", 实际:" + str(
|
148
|
+
"excel内容-行数和预期对比差" + check_row.__str__() + "行" + ", 实际:" + str(
|
149
|
+
actual_num) + "预期: " + str(
|
275
150
|
expected_num))
|
276
151
|
# 断言不匹配行
|
277
152
|
if check_row >= 0:
|
278
153
|
num = len(expected)
|
279
154
|
else:
|
280
155
|
num = len(actual)
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
156
|
+
if isinstance(actual, list) and isinstance(expected, list):
|
157
|
+
for i in range(num):
|
158
|
+
if actual[i] == expected[i]:
|
159
|
+
continue
|
160
|
+
else:
|
161
|
+
errors.append(
|
162
|
+
"excel内容-第" + str(i + 1) + "行不匹配,预期为:" + str(expected[i]) + ", 实际为: " + str(
|
163
|
+
actual[i]))
|
164
|
+
return False, errors
|
165
|
+
else:
|
166
|
+
return False, compare_dicts(actual, expected)
|
288
167
|
except Exception as e:
|
289
168
|
print(f":excel内容-服务异常{e}")
|
290
169
|
return False, [e]
|
291
170
|
|
292
171
|
|
293
|
-
def check_excel_header(
|
172
|
+
def check_excel_header(actual, expected):
|
294
173
|
"""
|
295
174
|
比较两个文档第一列的header是否一致
|
296
|
-
@param
|
297
|
-
@param
|
175
|
+
@param actual:
|
176
|
+
@param expected:
|
177
|
+
@return:
|
298
178
|
@return:
|
299
179
|
"""
|
300
|
-
|
301
|
-
|
302
|
-
|
180
|
+
try:
|
181
|
+
if all([isinstance(actual, str), isinstance(expected, str)]):
|
182
|
+
actual, expected = read_excel_header(read_excel_from_oss(actual)), read_excel_from_oss(
|
183
|
+
expected)
|
184
|
+
else:
|
185
|
+
actual, expected = read_excel_header(actual), read_excel_header(
|
186
|
+
expected)
|
187
|
+
if actual == expected:
|
188
|
+
return True, "表头校验值与顺序一致"
|
189
|
+
else:
|
190
|
+
return False,"表头校验值与顺序失败"
|
191
|
+
except:
|
192
|
+
return False, "表头校验异常"
|
303
193
|
|
304
194
|
|
305
195
|
def del_temp_file(file_name=""):
|
@@ -311,4 +201,35 @@ def del_temp_file(file_name=""):
|
|
311
201
|
except FileNotFoundError:
|
312
202
|
print(f"文件 {file_path} 不存在。")
|
313
203
|
except Exception as e:
|
314
|
-
print(f"删除文件 {file_path} 时出错:{e}")
|
204
|
+
print(f"删除文件 {file_path} 时出错:{e}")
|
205
|
+
|
206
|
+
|
207
|
+
def compare_dicts(dict1, dict2):
|
208
|
+
diff = {}
|
209
|
+
# 找出只在 dict1 中存在的键
|
210
|
+
only_in_dict1 = set(dict1.keys()) - set(dict2.keys())
|
211
|
+
if only_in_dict1:
|
212
|
+
diff['only_in_dict1'] = {key: dict1[key] for key in only_in_dict1}
|
213
|
+
# 找出只在 dict2 中存在的键
|
214
|
+
only_in_dict2 = set(dict2.keys()) - set(dict1.keys())
|
215
|
+
if only_in_dict2:
|
216
|
+
diff['only_in_dict2'] = {key: dict2[key] for key in only_in_dict2}
|
217
|
+
# 处理两个字典都有的键
|
218
|
+
common_keys = set(dict1.keys()) & set(dict2.keys())
|
219
|
+
for key in common_keys:
|
220
|
+
value1 = dict1[key]
|
221
|
+
value2 = dict2[key]
|
222
|
+
if isinstance(value1, dict) and isinstance(value2, dict):
|
223
|
+
# 如果值是字典,递归比较
|
224
|
+
sub_diff = compare_dicts(value1, value2)
|
225
|
+
if sub_diff:
|
226
|
+
diff[f'different_sub_dicts_at_{key}'] = sub_diff
|
227
|
+
elif isinstance(value1, list) and isinstance(value2, list):
|
228
|
+
# 如果值是列表,比较列表元素
|
229
|
+
if value1 != value2:
|
230
|
+
diff[f'different_lists_at_{key}'] = (value1, value2)
|
231
|
+
else:
|
232
|
+
# 其他情况,直接比较值
|
233
|
+
if value1 != value2:
|
234
|
+
diff[f'different_values_at_{key}'] = (value1, value2)
|
235
|
+
return diff
|
@@ -0,0 +1,116 @@
|
|
1
|
+
import io
|
2
|
+
import json
|
3
|
+
import os
|
4
|
+
import re
|
5
|
+
import warnings
|
6
|
+
from io import BytesIO
|
7
|
+
from typing import Dict, Any
|
8
|
+
|
9
|
+
import pandas as pd
|
10
|
+
from pandas import DataFrame
|
11
|
+
from requests import request
|
12
|
+
|
13
|
+
warnings.simplefilter("ignore")
|
14
|
+
|
15
|
+
|
16
|
+
def read_excel_from_oss(url="", method="get"):
|
17
|
+
"""读取oss的excel内容转为io流数据"""
|
18
|
+
try:
|
19
|
+
result = request(method=method, url=url)
|
20
|
+
excel_data = BytesIO(result.content)
|
21
|
+
print(f"成功读取oss文件内容: {url}")
|
22
|
+
return excel_data
|
23
|
+
except Exception as e:
|
24
|
+
print(f"读取oss报错 {url} 时出错:{e}")
|
25
|
+
|
26
|
+
|
27
|
+
def read_excel_header(excel_data, **kwargs) -> list:
|
28
|
+
"""
|
29
|
+
1、根据oss link 直接读出excel的头列 list
|
30
|
+
"""
|
31
|
+
try:
|
32
|
+
dfs = read_excel_data(excel_data)
|
33
|
+
result = []
|
34
|
+
for sheet_name, df in dfs.items():
|
35
|
+
result.append(df.keys().values.tolist())
|
36
|
+
return result
|
37
|
+
except Exception as e:
|
38
|
+
print(f"excel生成header-list出错:{e}")
|
39
|
+
|
40
|
+
|
41
|
+
def read_excel_data(excel_data, **kwargs):
|
42
|
+
with warnings.catch_warnings():
|
43
|
+
warnings.filterwarnings("ignore", category=UserWarning, module=re.escape('openpyxl.styles.stylesheet'))
|
44
|
+
dfs = pd.read_excel(excel_data, sheet_name=None, na_filter=False, **kwargs) if isinstance(excel_data,io.BytesIO) \
|
45
|
+
else excel_data
|
46
|
+
return dfs
|
47
|
+
|
48
|
+
|
49
|
+
def read_excel_and_write_to_dict(excel_data=None, file_name=None, **kwargs):
|
50
|
+
"""excel内容并写入到内存dict中
|
51
|
+
:param excel_data:excel的io对象, 参数和file_name互斥
|
52
|
+
:file_name: excel文件名称,目前读取check_file目录下文件,参数和excel_data互斥
|
53
|
+
"""
|
54
|
+
try:
|
55
|
+
if excel_data is not None and file_name is not None:
|
56
|
+
pass
|
57
|
+
elif file_name is not None:
|
58
|
+
excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
|
59
|
+
dfs = read_excel_data(excel_data)
|
60
|
+
# 将DataFrame转换为字典,以行为单位存储数据
|
61
|
+
row_dict = {} # 创建一个空字典来存储按行转换的数据
|
62
|
+
for sheet_name, row in dfs.items():
|
63
|
+
row_dict[sheet_name] = row.to_dict(orient='records')
|
64
|
+
return row_dict
|
65
|
+
except Exception as e:
|
66
|
+
print(f"excel写入dict时出错:{e}")
|
67
|
+
|
68
|
+
|
69
|
+
def read_excel_and_write_to_list(excel_data=None, sheet_name=None, file_name=None, **kwargs):
|
70
|
+
"""excel内容并写入到内存list中
|
71
|
+
:param excel_data:excel的io对象, 参数和file_name互斥
|
72
|
+
:file_name: excel文件名称,目前读取check_file目录下文件,参数和excel_data互斥
|
73
|
+
"""
|
74
|
+
try:
|
75
|
+
if excel_data is not None and file_name is not None:
|
76
|
+
pass
|
77
|
+
elif file_name is not None:
|
78
|
+
excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
|
79
|
+
dfs = read_excel_data(excel_data)
|
80
|
+
rows_list = []
|
81
|
+
# 多sheet处理
|
82
|
+
for name, df in dfs.items():
|
83
|
+
rows_list.append(df.values.tolist())
|
84
|
+
if len(dfs) <= 1:
|
85
|
+
rows_list = rows_list[0]
|
86
|
+
return rows_list
|
87
|
+
except Exception as e:
|
88
|
+
print(f"excel写入list时出错:{e}")
|
89
|
+
|
90
|
+
|
91
|
+
def read_excel_and_write_to_csv(excel_data, file_name, **kwargs):
|
92
|
+
"""excel内容并写入到csv中"""
|
93
|
+
try:
|
94
|
+
df = pd.read_excel(excel_data, engine="openpyxl")
|
95
|
+
local_csv_path = os.path.join(os.path.dirname(os.getcwd()) + "/temp_file/" + file_name)
|
96
|
+
df.to_csv(local_csv_path, index=False, **kwargs)
|
97
|
+
return local_csv_path
|
98
|
+
except Exception as e:
|
99
|
+
print(f"excel写入csv时出错:{e}")
|
100
|
+
|
101
|
+
|
102
|
+
def read_excel_data_for_oss_write_to_dict(oss, **kwargs) -> dict:
|
103
|
+
"""
|
104
|
+
1、根据oss link 直接读出 dict-list
|
105
|
+
2、支持多sheet,默认sheet_name =None查全部
|
106
|
+
3、返回dict结构 {'sheet_name':[rows_list]}
|
107
|
+
"""
|
108
|
+
try:
|
109
|
+
dfs = read_excel_data(read_excel_from_oss(oss))
|
110
|
+
result = {}
|
111
|
+
for sheet_name, df in dfs.items():
|
112
|
+
rows_list = df.values.tolist()
|
113
|
+
result[sheet_name] = rows_list
|
114
|
+
return result
|
115
|
+
except Exception as e:
|
116
|
+
print(f"excel生成dict出错:{e}")
|
smartpush/test.py
CHANGED
@@ -1,19 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# -*- codeing = utf-8 -*-
|
2
|
+
# @Time :2025/2/20 00:27
|
3
|
+
# @Author :luzebin
|
4
|
+
from smartpush.export.basic.ExcelExportChecker import check_excel_all
|
4
5
|
|
5
6
|
if __name__ == '__main__':
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
_id = 10901
|
10
|
-
url = "https://test.smartpushedm.com/api-em-ec2/bulkOps/query"
|
11
|
-
requestHeaders = {
|
12
|
-
'cookie': 'osudb_appid=SMARTPUSH;osudb_oar=#01#SID0000121BJe/0W0PdWQj0Wo/Cr4G9H5S58u/YpvUYbOxsyvHQXmU5iToD8h3GX0+/3Af1efOroDv2jIwJIPVx2F1/XCP08l/NOaWMIZ/xm1/ugKB7eA1k1akIdCSTOHJcJ95Ahp7Yz0cBgOwtr8OgF77WNxX;osudb_subappid=1;osudb_uid=4213785247;ecom_http_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDIwMTEyNDcsImp0aSI6IjY4M2E1NDg1LTEwYjAtNDRhZS04MGMxLWQ1MmFkN2YxNmViNCIsInVzZXJJbmZvIjp7ImlkIjowLCJ1c2VySWQiOiI0MjEzNzg1MjQ3IiwidXNlcm5hbWUiOiIiLCJlbWFpbCI6ImZlbGl4LnNoYW9Ac2hvcGxpbmVhcHAuY29tIiwidXNlclJvbGUiOiJvd25lciIsInBsYXRmb3JtVHlwZSI6Nywic3ViUGxhdGZvcm0iOjEsInBob25lIjoiIiwibGFuZ3VhZ2UiOiJ6aC1oYW5zLWNuIiwiYXV0aFR5cGUiOiIiLCJhdHRyaWJ1dGVzIjp7ImNvdW50cnlDb2RlIjoiQ04iLCJjdXJyZW5jeSI6IkpQWSIsImN1cnJlbmN5U3ltYm9sIjoiSlDCpSIsImRvbWFpbiI6InNtYXJ0cHVzaDQubXlzaG9wbGluZXN0Zy5jb20iLCJsYW5ndWFnZSI6ImVuIiwibWVyY2hhbnRFbWFpbCI6ImZlbGl4LnNoYW9Ac2hvcGxpbmUuY29tIiwibWVyY2hhbnROYW1lIjoiU21hcnRQdXNoNF9lYzJf6Ieq5Yqo5YyW5bqX6ZO6IiwicGhvbmUiOiIiLCJzY29wZUNoYW5nZWQiOmZhbHNlLCJzdGFmZkxhbmd1YWdlIjoiemgtaGFucy1jbiIsInN0YXR1cyI6MCwidGltZXpvbmUiOiJBc2lhL01hY2FvIn0sInN0b3JlSWQiOiIxNjQ0Mzk1OTIwNDQ0IiwiaGFuZGxlIjoic21hcnRwdXNoNCIsImVudiI6IkNOIiwic3RlIjoiIiwidmVyaWZ5IjoiIn0sImxvZ2luVGltZSI6MTczOTQxOTI0Nzg2OSwic2NvcGUiOlsiZW1haWwtbWFya2V0IiwiY29va2llIiwic2wtZWNvbS1lbWFpbC1tYXJrZXQtbmV3LXRlc3QiLCJlbWFpbC1tYXJrZXQtbmV3LWRldi1mcyIsImFwaS11Yy1lYzIiLCJhcGktc3UtZWMyIiwiYXBpLWVtLWVjMiIsImZsb3ctcGx1Z2luIl0sImNsaWVudF9pZCI6ImVtYWlsLW1hcmtldCJ9.PJGM1sSZyvxTriMK4e1g90krqBUq9OVNc5vEyKxsXyQ;',
|
13
|
-
'Content-Type': 'application/json'}
|
14
|
-
requestParams = {'page': 1, 'pageSize': 10, 'type': 'EXPORT', 'status': None, 'startTime': None, 'endTime': None}
|
15
|
-
oss=get_oss_address_with_retry(_id, url, requestHeaders, requestParams, tries=1, delay=1, backoff=1)
|
16
|
-
eexcelxcel = check_excel_for_lu("all",
|
17
|
-
expected_oss=oss,
|
18
|
-
actual_oss=oss)
|
19
|
-
print(eexcelxcel)
|
7
|
+
oss1 = "https://cdn.smartpushedm.com/material_ec2/2025-02-19/4d98418295524ab1b52340c2ed2afa4a/AutoTest-%E5%9B%BA%E5%AE%9AB-2025-02-14%20%E5%88%9B%E5%BB%BA%E7%9A%84Email33%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
|
8
|
+
oss2 = "https://cdn.smartpushedm.com/material_ec2/2025-02-19/ddbe9965d83840199e678a66dc414518/%E8%90%A5%E9%94%80%E4%BB%BB%E5%8A%A1%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
|
9
|
+
print(check_excel_all(oss2, oss1))
|
@@ -1,13 +1,14 @@
|
|
1
1
|
smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
|
2
2
|
smartpush/get_jira_info.py,sha256=dmCwkKa94xwyE2hegE1KBI3cV_LbrJ67P9osORUGPt4,2633
|
3
|
-
smartpush/test.py,sha256=
|
3
|
+
smartpush/test.py,sha256=VCemS6i05wjGmwo-hUXC83OTHbUL2KeEqoTfio6Rwqk,600
|
4
4
|
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
5
|
-
smartpush/export/basic/ExcelExportChecker.py,sha256=
|
5
|
+
smartpush/export/basic/ExcelExportChecker.py,sha256=1tK103jGfofQUu_xABjgQL7abS5j8fGZ9Cn0O56ABis,9589
|
6
6
|
smartpush/export/basic/GetOssUrl.py,sha256=O2-HtcYzbabck9dKgLu8ga21_AiyDIzgdfoDgvqBY3c,1541
|
7
|
+
smartpush/export/basic/ReadExcel.py,sha256=kkMjA8p8IIludlSf6zyYnWX5AAG_x5DA1MvK5i1c2eg,4119
|
7
8
|
smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
|
8
9
|
smartpush/utils/StringUtils.py,sha256=NXomJ4qmyBRAFnGj5hrFRWwQnRQMTcPzy20fk1dunSw,3980
|
9
10
|
smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
smartpush-1.1.
|
11
|
-
smartpush-1.1.
|
12
|
-
smartpush-1.1.
|
13
|
-
smartpush-1.1.
|
11
|
+
smartpush-1.1.3.dist-info/METADATA,sha256=4r29z282fZPKB9dEWJiiX6aCRJwCTUvDtpqNT2Ur0QU,145
|
12
|
+
smartpush-1.1.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
13
|
+
smartpush-1.1.3.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
14
|
+
smartpush-1.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|