mdbq 3.4.4__py3-none-any.whl → 3.4.6__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.
@@ -22,18 +22,29 @@ from io import BytesIO
22
22
  from PIL import Image
23
23
  import base64
24
24
  import matplotlib.pyplot as plt
25
+ from matplotlib import rcParams
25
26
 
26
27
  from sqlalchemy.sql.functions import count
27
28
 
28
29
  if platform.system() == 'Windows':
30
+ ip_address = '192.168.1.117'
31
+ rcParams['font.sans-serif'] = ['SimHei'] # matplotlibrc 防止中文乱码
29
32
  D_PATH = os.path.join(f'C:\\Users\\{getpass.getuser()}\\Downloads')
30
33
  elif platform.system() == 'Linux':
34
+ ip_address = '127.0.0.1'
35
+ rcParams['font.sans-serif'] = ['Arial Unicode MS'] # matplotlibrc 防止中文乱码
31
36
  D_PATH = 'Downloads'
32
37
  if not os.path.exists(D_PATH):
33
38
  os.makedirs(D_PATH)
34
39
  else:
40
+ ip_address = '127.0.0.1'
41
+ rcParams['font.sans-serif'] = ['Arial Unicode MS'] # matplotlibrc 防止中文乱码
35
42
  D_PATH = os.path.join(f'/Users/{getpass.getuser()}/Downloads')
36
43
 
44
+ PORT = 5050
45
+ DIRECTORY = os.path.join(D_PATH, 'http_server')
46
+
47
+ rcParams['axes.unicode_minus'] = False # 防止负号'-'被当作减号处理
37
48
  m_engine = mysql.MysqlUpload(username='', password='', host='', port=0, charset='utf8mb4')
38
49
  company_engine = mysql.MysqlUpload(username='', password='', host='', port=0, charset='utf8mb4')
39
50
 
@@ -936,15 +947,9 @@ class DataShow:
936
947
  pic_title1 = '商品花费占比'
937
948
  img_file1 = os.path.join(temp_dir, f'{pic_title1}.png')
938
949
  if not os.path.isfile(img_file1):
939
- font_properties = {
940
- 'family': 'PingFang HK', # 字体类型 PingFang HK, Hiragino Sans GB, Arial Unicode MS
941
- 'size': 12, # 字体大小
942
- 'weight': 'light', # 字体粗细('light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black')
943
- 'style': 'italic' # 字体样式('normal', 'italic', 'oblique')
944
- }
945
950
  fig, ax = plt.subplots()
946
951
  ax.pie(df_new['花费'], labels=df_new['商品id'], autopct='%1.1f%%', startangle=140)
947
- ax.set_title(pic_title1, fontdict=font_properties) # 设置饼图的标题
952
+ ax.set_title(pic_title1) # 设置饼图的标题
948
953
  ax.axis('equal') # 确保饼图是圆形的
949
954
  plt.savefig(img_file1) # 保存饼图为PNG文件
950
955
  plt.close()
@@ -980,195 +985,199 @@ class DataShow:
980
985
  # 应用这个函数到图片列
981
986
  df['Image_HTML'] = df['白底图'].apply(convert_image_to_html)
982
987
 
983
- local_file1 = os.path.join(self.path, '多店推广场景.html')
984
- local_file2 = os.path.join(self.path, '多店推广场景.html')
985
- local_file3 = os.path.join(self.path, '多店推广场景.html')
986
- local_file4 = os.path.join(self.path, '多店推广场景.html')
987
- local_file5 = os.path.join(self.path, '多店推广场景.html')
988
-
989
988
  # 创建 HTML
990
989
  html_template = """
991
- <head>
992
- <meta charset="UTF-8">
993
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
994
- <title>商品推广数据</title>
995
- <style>
996
- .centered-table {
997
- margin-top: 20px;
998
- margin-down: 100px;
999
- margin-left: auto;
1000
- margin-right: auto;
1001
- border-collapse: collapse; /* 可选,用于合并表格边框 */
1002
- width: 60%; /* 设置表格宽度为父容器宽度的50%,或者你可以使用固定宽度 */
1003
- }
1004
- thead th {
1005
- background-color: #f2f2f2; /* 设置表头背景颜色 */
1006
- font-size: 16px; /* 增大表头字体 */
1007
- font-weight: bold; /* 加粗表头字体 */
1008
- text-align: center; /* 设置表头文本居中 */
1009
- }
1010
- caption {
1011
- caption-side: top; /* 标题显示在表格上方 */
1012
- font-size: 24px; /* 设置标题字体大小 */
1013
- font-weight: bold; /* 设置标题字体加粗 */
1014
- text-align: center; /* 设置标题文本居中 */
1015
- margin-bottom: 20px; /* 为标题和表格之间添加间距 */
1016
- }
1017
- td, th {
1018
- border: 1px solid #ddd; /* 单元格边框 */
1019
- line-height: 1em; /* 设置行高为2倍的当前字体大小 */
1020
- padding: 5 5px; /* 设置左右边距,内边距增加单元格的整体高度 */
1021
- text-align: center; /* 设置文本对齐方式 */
1022
- }
1023
- img {
1024
- width: 80px; /* 设置图片宽度 */
1025
- height: auto; /* 高度自动调整以保持宽高比 */
1026
- /* 如果需要垂直居中且图片是块级元素,则可以使用以下样式(但通常不是必需的,因为图片默认是内联元素)
1027
- text-align: center; /* 水平居中(适用于内联或块级子元素) */
1028
- display: block;
1029
- margin: 0 auto; */
1030
- }
1031
- button {
1032
- border: none;
1033
- padding: 8px 12px;
1034
- font-size: 14px;
1035
- cursor: pointer;
1036
- }
1037
- .centered-text {
1038
- position: fixed; /* 固定定位 */
1039
- bottom: 15px; /* 距离页面顶部10px(可根据需要调整) */
1040
- right: calc(25vw - 420px); /* 距离页面右侧1/4宽度减去文本自身的宽度和可能的边距(这里假设文本宽度和边距共10px,实际情况需根据文本样式调整) */
1041
- /* 如果文本宽度未知或可变,可以只使用25vw并接受可能的溢出 */
1042
- /* right: 25vw; */ /* 直接使用25vw定位,不考虑文本宽度 */
1043
- padding: 3px 10px; /* 可选的文本内边距 */
1044
- background-color: rgba(255, 255, 255, 0.8); /* 可选的背景色和透明度 */
1045
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* 可选的阴影效果 */
1046
- }
1047
-
1048
- .image-container {
1049
- position: absolute; /* 使用绝对定位 */
1050
- width: 15%; /* 设置图片宽度 */
1051
- left: 10px; /* 距离页面左侧20px */
1052
- top: 50%; /* 距离页面顶部50% */
1053
- transform: translateY(-50%); /* 向上移动自身高度的一半,以实现垂直居中 */
1054
- }
1055
- .image-container img {
1056
- width: 20%; /* 设置图片宽度 */
1057
- height: auto; /* 高度自动调整以保持宽高比 */
1058
- /* 如果需要垂直居中且图片是块级元素,则可以使用以下样式(但通常不是必需的,因为图片默认是内联元素)*/
1059
- display: flex;
1060
- flex-direction: column;
1061
- align-items: flex-start;
1062
- }
1063
- .button1 {
1064
- border: none;
1065
- padding: 8px 12px;
1066
- font-size: 14px;
1067
- cursor: pointer;
1068
- position: absolute; /* 使用绝对定位 */
1069
- left: 5%; /* 距离页面左侧20px */
1070
- top: 10%; /* 距离页面顶部50% */
1071
- }
1072
- .button2 {
1073
- border: none;
1074
- padding: 8px 12px;
1075
- font-size: 14px;
1076
- cursor: pointer;
1077
- position: absolute; /* 使用绝对定位 */
1078
- left: 5%; /* 距离页面左侧20px */
1079
- top: 17%; /* 距离页面顶部50% */
1080
- }
1081
- .button3 {
1082
- border: none;
1083
- padding: 8px 12px;
1084
- font-size: 14px;
1085
- cursor: pointer;
1086
- position: absolute; /* 使用绝对定位 */
1087
- left: 5%; /* 距离页面左侧20px */
1088
- top: 24%; /* 距离页面顶部50% */
1089
- }
1090
- .button4 {
1091
- border: none;
1092
- padding: 8px 12px;
1093
- font-size: 14px;
1094
- cursor: pointer;
1095
- position: absolute; /* 使用绝对定位 */
1096
- left: 5%; /* 距离页面左侧20px */
1097
- top: 31%; /* 距离页面顶部50% */
1098
- }
1099
- .button5 {
1100
- border: none;
1101
- padding: 8px 12px;
1102
- font-size: 14px;
1103
- cursor: pointer;
1104
- position: absolute; /* 使用绝对定位 */
1105
- left: 5%; /* 距离页面左侧20px */
1106
- top: 38%; /* 距离页面顶部50% */
1107
- }
1108
-
1109
- </style>
1110
- </head>
1111
-
1112
- <div class="div-button">
1113
- <!-- 创建一个按钮 -->
1114
- <button id="button1" class="button1">多店推广场景</button>
1115
- <button id="button2" class="button2">店铺流量来源</button>
1116
- <button id="button3" class="button3">达摩盘人群画像</button>
1117
- <button id="button4" class="button4">商品人群画像</button>
1118
- <button id="button5" class="button5">销售地域分布</button>
1119
- </div>
1120
- <script>
1121
- // 获取按钮元素
1122
- var tg = document.getElementById('button1');
1123
- var dpll = document.getElementById('button2');
1124
- var dmp1 = document.getElementById('button3');
1125
- var dmp2 = document.getElementById('button4');
1126
- var syj = document.getElementById('button5');
1127
- tg.addEventListener('click', function() {
1128
- window.open('{local_file1}', '_blank');
1129
- });
1130
- dpll.addEventListener('click', function() {
1131
- window.open('{local_file2}', '_blank');
1132
- });
1133
- dmp1.addEventListener('click', function() {
1134
- window.open('{local_file3}', '_blank');
1135
- });
1136
- dmp2.addEventListener('click', function() {
1137
- window.open('{local_file4}', '_blank');
1138
- });
1139
- syj.addEventListener('click', function() {
1140
- window.open('{local_file5}', '_blank');
1141
- });
1142
- </script>
1143
-
1144
- <p class="centered-text">统计周期</p>
1145
- <!--
1146
- <img class="image-container" src="{img_file1}" alt="图片">
1147
- -->
1148
- <table class="centered-table">
1149
- <thead>
1150
- <caption>天猫商品推广数据</caption>
1151
- <div>
1152
- <tr>
1153
- <th>序号</th>
1154
- <th>商品</th>
1155
- <th>店铺名称</th>
1156
- <th>商品id</th>
1157
- <th>花费</th>
1158
- <th>花费占比</th>
1159
- <th>点击量</th>
1160
- <th>加购量</th>
1161
- <th>成交笔数</th>
1162
- <th>成交金额</th>
1163
- <th>roi投产</th>
1164
- </tr>
1165
- </div>
1166
- </thead>
1167
- <tbody>
1168
- {rows}
1169
- </tbody>
1170
- </table>
1171
- """
990
+ <!DOCTYPE html>
991
+ <html lang="zh-CN">
992
+ <head>
993
+ <meta charset="UTF-8">
994
+ <meta http-equiv="Content-Type" content="text/html>
995
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
996
+ <title>商品推广数据</title>
997
+ <style>
998
+ body {
999
+ font-family: Arial, Helvetica, sans-serif;
1000
+ line-height: 1.6;
1001
+ margin: 0;
1002
+ padding: 0;
1003
+ background-color: #f4f4f4;
1004
+ }
1005
+ .centered-table {
1006
+ margin-top: 20px;
1007
+ margin-down: 100px;
1008
+ margin-left: auto;
1009
+ margin-right: auto;
1010
+ border-collapse: collapse; /* 可选,用于合并表格边框 */
1011
+ width: 60%; /* 设置表格宽度为父容器宽度的50%,或者你可以使用固定宽度 */
1012
+ }
1013
+ thead th {
1014
+ background-color: #f2f2f2; /* 设置表头背景颜色 */
1015
+ font-size: 16px; /* 增大表头字体 */
1016
+ font-weight: bold; /* 加粗表头字体 */
1017
+ text-align: center; /* 设置表头文本居中 */
1018
+ }
1019
+ caption {
1020
+ caption-side: top; /* 标题显示在表格上方 */
1021
+ font-size: 24px; /* 设置标题字体大小 */
1022
+ font-weight: bold; /* 设置标题字体加粗 */
1023
+ text-align: center; /* 设置标题文本居中 */
1024
+ margin-bottom: 20px; /* 为标题和表格之间添加间距 */
1025
+ }
1026
+ td, th {
1027
+ border: 1px solid #ddd; /* 单元格边框 */
1028
+ line-height: 1em; /* 设置行高为2倍的当前字体大小 */
1029
+ padding: 5 5px; /* 设置左右边距,内边距增加单元格的整体高度 */
1030
+ text-align: center; /* 设置文本对齐方式 */
1031
+ }
1032
+ img {
1033
+ width: 80px; /* 设置图片宽度 */
1034
+ height: auto; /* 高度自动调整以保持宽高比 */
1035
+ /* 如果需要垂直居中且图片是块级元素,则可以使用以下样式(但通常不是必需的,因为图片默认是内联元素)
1036
+ text-align: center; /* 水平居中(适用于内联或块级子元素) */
1037
+ display: block;
1038
+ margin: 0 auto; */
1039
+ }
1040
+ button {
1041
+ border: none;
1042
+ padding: 8px 12px;
1043
+ font-size: 14px;
1044
+ cursor: pointer;
1045
+ }
1046
+ .centered-text {
1047
+ position: fixed; /* 固定定位 */
1048
+ bottom: 15px; /* 距离页面顶部10px(可根据需要调整) */
1049
+ right: calc(25vw - 420px); /* 距离页面右侧1/4宽度减去文本自身的宽度和可能的边距(这里假设文本宽度和边距共10px,实际情况需根据文本样式调整) */
1050
+ /* 如果文本宽度未知或可变,可以只使用25vw并接受可能的溢出 */
1051
+ /* right: 25vw; */ /* 直接使用25vw定位,不考虑文本宽度 */
1052
+ padding: 3px 10px; /* 可选的文本内边距 */
1053
+ background-color: rgba(255, 255, 255, 0.8); /* 可选的背景色和透明度 */
1054
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* 可选的阴影效果 */
1055
+ }
1056
+
1057
+ .image-container {
1058
+ position: absolute; /* 使用绝对定位 */
1059
+ width: 15%; /* 设置图片宽度 */
1060
+ left: 10px; /* 距离页面左侧20px */
1061
+ top: 50%; /* 距离页面顶部50% */
1062
+ transform: translateY(-50%); /* 向上移动自身高度的一半,以实现垂直居中 */
1063
+ }
1064
+ .image-container img {
1065
+ width: 20%; /* 设置图片宽度 */
1066
+ height: auto; /* 高度自动调整以保持宽高比 */
1067
+ /* 如果需要垂直居中且图片是块级元素,则可以使用以下样式(但通常不是必需的,因为图片默认是内联元素)*/
1068
+ display: flex;
1069
+ flex-direction: column;
1070
+ align-items: flex-start;
1071
+ }
1072
+ .button1 {
1073
+ border: none;
1074
+ padding: 8px 12px;
1075
+ font-size: 14px;
1076
+ cursor: pointer;
1077
+ position: absolute; /* 使用绝对定位 */
1078
+ left: 5%; /* 距离页面左侧20px */
1079
+ top: 10%; /* 距离页面顶部50% */
1080
+ }
1081
+ .button2 {
1082
+ border: none;
1083
+ padding: 8px 12px;
1084
+ font-size: 14px;
1085
+ cursor: pointer;
1086
+ position: absolute; /* 使用绝对定位 */
1087
+ left: 5%; /* 距离页面左侧20px */
1088
+ top: 17%; /* 距离页面顶部50% */
1089
+ }
1090
+ .button3 {
1091
+ border: none;
1092
+ padding: 8px 12px;
1093
+ font-size: 14px;
1094
+ cursor: pointer;
1095
+ position: absolute; /* 使用绝对定位 */
1096
+ left: 5%; /* 距离页面左侧20px */
1097
+ top: 24%; /* 距离页面顶部50% */
1098
+ }
1099
+ .button4 {
1100
+ border: none;
1101
+ padding: 8px 12px;
1102
+ font-size: 14px;
1103
+ cursor: pointer;
1104
+ position: absolute; /* 使用绝对定位 */
1105
+ left: 5%; /* 距离页面左侧20px */
1106
+ top: 31%; /* 距离页面顶部50% */
1107
+ }
1108
+ .button5 {
1109
+ border: none;
1110
+ padding: 8px 12px;
1111
+ font-size: 14px;
1112
+ cursor: pointer;
1113
+ position: absolute; /* 使用绝对定位 */
1114
+ left: 5%; /* 距离页面左侧20px */
1115
+ top: 38%; /* 距离页面顶部50% */
1116
+ }
1117
+ </style>
1118
+ </head>
1119
+
1120
+ <div class="div-button">
1121
+ <!-- 创建一个按钮 -->
1122
+ <button id="button1" class="button1">多店推广场景</button>
1123
+ <button id="button2" class="button2">店铺流量来源</button>
1124
+ <button id="button3" class="button3">达摩盘人群画像</button>
1125
+ <button id="button4" class="button4">商品人群画像</button>
1126
+ <button id="button5" class="button5">销售地域分布</button>
1127
+ </div>
1128
+ <script>
1129
+ // 获取按钮元素
1130
+ var tg = document.getElementById('button1');
1131
+ var dpll = document.getElementById('button2');
1132
+ var dmp1 = document.getElementById('button3');
1133
+ var dmp2 = document.getElementById('button4');
1134
+ var syj = document.getElementById('button5');
1135
+ tg.addEventListener('click', function() {
1136
+ window.open('{local_file1}', '_blank');
1137
+ });
1138
+ dpll.addEventListener('click', function() {
1139
+ window.open('{local_file2}', '_blank');
1140
+ });
1141
+ dmp1.addEventListener('click', function() {
1142
+ window.open('{local_file3}', '_blank');
1143
+ });
1144
+ dmp2.addEventListener('click', function() {
1145
+ window.open('{local_file4}', '_blank');
1146
+ });
1147
+ syj.addEventListener('click', function() {
1148
+ window.open('{local_file5}', '_blank');
1149
+ });
1150
+ </script>
1151
+
1152
+ <p class="centered-text">统计周期</p>
1153
+ <!--
1154
+ <img class="image-container" src="{img_file1}" alt="图片">
1155
+ -->
1156
+ <table class="centered-table">
1157
+ <thead>
1158
+ <caption>天猫商品推广数据</caption>
1159
+ <div>
1160
+ <tr>
1161
+ <th>序号</th>
1162
+ <th>商品</th>
1163
+ <th>店铺名称</th>
1164
+ <th>商品id</th>
1165
+ <th>花费</th>
1166
+ <th>花费占比</th>
1167
+ <th>点击量</th>
1168
+ <th>加购量</th>
1169
+ <th>成交笔数</th>
1170
+ <th>成交金额</th>
1171
+ <th>roi投产</th>
1172
+ </tr>
1173
+ </div>
1174
+ </thead>
1175
+ <tbody>
1176
+ {rows}
1177
+ </tbody>
1178
+ </table>
1179
+ </html>
1180
+ """
1172
1181
  rows = []
1173
1182
  for _, row in df.iterrows():
1174
1183
  row_html = (f'<tr>'
@@ -1189,13 +1198,13 @@ class DataShow:
1189
1198
 
1190
1199
  final_html = html_template.replace('{rows}', ''.join(rows))
1191
1200
  final_html = final_html.replace('统计周期', f'统计周期: {min_date} ~ {max_date}')
1192
- final_html = final_html.replace('{local_file1}', local_file1)
1193
- final_html = final_html.replace('{local_file2}', local_file2)
1194
- final_html = final_html.replace('{local_file3}', local_file3)
1195
- final_html = final_html.replace('{local_file4}', local_file4)
1196
- final_html = final_html.replace('{local_file5}', local_file5)
1201
+ final_html = final_html.replace('{local_file1}', '多店推广场景.html')
1202
+ final_html = final_html.replace('{local_file2}', '店铺流量来源.html')
1203
+ final_html = final_html.replace('{local_file3}', '达摩盘人群画像.html')
1204
+ final_html = final_html.replace('{local_file4}', '商品人群画像.html')
1205
+ final_html = final_html.replace('{local_file5}', '销售地域分布.html')
1197
1206
  file = os.path.join(self.path, f'{filename}.html')
1198
- with open(file, 'w') as f:
1207
+ with open(file, 'w', encoding='utf-8') as f:
1199
1208
  f.write(final_html)
1200
1209
 
1201
1210
 
@@ -1210,45 +1219,45 @@ def main():
1210
1219
  start_date='2024-12-01',
1211
1220
  end_date=None,
1212
1221
  )
1213
- # 店铺流量来源
1214
- ds.dpll()
1215
- # 多店聚合推广数据
1216
- ds.tg(
1217
- days=15,
1218
- # start_date='2024-11-01',
1219
- # end_date='2024-11-30',
1220
- )
1221
-
1222
- # 商品人群画像
1223
- item_id_list = [
1224
- 839148235697,
1225
- ]
1226
- for item_id in item_id_list:
1227
- ds.item_crowd(
1228
- item_id=item_id,
1229
- lab='全部渠道',
1230
- option='商详浏览',
1231
- last_date=None,
1232
- d_str='近30天',
1233
- )
1234
-
1235
- # 达摩盘人群画像
1236
- crowid_list = [
1237
- 40457166,
1238
- ]
1239
- for crowid in crowid_list:
1240
- ds.crowd(
1241
- crowd_id=crowid,
1242
- last_date=None,
1243
- )
1244
-
1245
- ds.pov_city(
1246
- db_name='生意经3',
1247
- filename='销售地域分布',
1248
- start_date='2024-12-01',
1249
- end_date=None,
1250
- percent=0.015,
1251
- )
1222
+ # # 店铺流量来源
1223
+ # ds.dpll()
1224
+ # # 多店聚合推广数据
1225
+ # ds.tg(
1226
+ # days=15,
1227
+ # # start_date='2024-11-01',
1228
+ # # end_date='2024-11-30',
1229
+ # )
1230
+ #
1231
+ # # 商品人群画像
1232
+ # item_id_list = [
1233
+ # 839148235697,
1234
+ # ]
1235
+ # for item_id in item_id_list:
1236
+ # ds.item_crowd(
1237
+ # item_id=item_id,
1238
+ # lab='全部渠道',
1239
+ # option='商详浏览',
1240
+ # last_date=None,
1241
+ # d_str='近30天',
1242
+ # )
1243
+ #
1244
+ # # 达摩盘人群画像
1245
+ # crowid_list = [
1246
+ # 40457166,
1247
+ # ]
1248
+ # for crowid in crowid_list:
1249
+ # ds.crowd(
1250
+ # crowd_id=crowid,
1251
+ # last_date=None,
1252
+ # )
1253
+ #
1254
+ # ds.pov_city(
1255
+ # db_name='生意经3',
1256
+ # filename='销售地域分布',
1257
+ # start_date='2024-12-01',
1258
+ # end_date=None,
1259
+ # percent=0.015,
1260
+ # )
1252
1261
 
1253
1262
 
1254
1263
  if __name__ == '__main__':
@@ -3887,10 +3887,10 @@ def main(days=150, months=3):
3887
3887
 
3888
3888
 
3889
3889
  if __name__ == '__main__':
3890
- # main(
3891
- # days=150, # 清理聚合数据的日期长度
3892
- # months=3 # 生成聚合数据的长度
3893
- # )
3890
+ main(
3891
+ days=30, # 清理聚合数据的日期长度
3892
+ months=2 # 生成聚合数据的长度
3893
+ )
3894
3894
 
3895
3895
  # query_list = [query1, query2]
3896
3896
  # # 使用 ThreadPoolExecutor 来并行运行
@@ -3914,10 +3914,10 @@ if __name__ == '__main__':
3914
3914
 
3915
3915
  # query3(months=2, less_dict=[])
3916
3916
 
3917
- sdq = MysqlDatasQuery() # 实例化数据处理类
3918
- sdq.months = 1 # 设置数据周期, 1 表示近 2 个月
3919
- sdq.update_service = True # 调试时加,true: 将数据写入 mysql 服务器
3920
- sdq.item_up()
3917
+ # sdq = MysqlDatasQuery() # 实例化数据处理类
3918
+ # sdq.months = 1 # 设置数据周期, 1 表示近 2 个月
3919
+ # sdq.update_service = True # 调试时加,true: 将数据写入 mysql 服务器
3920
+ # sdq.item_up()
3921
3921
 
3922
3922
  # string = '30-34岁,35-39岁,40-49岁'
3923
3923
  # d = "~".join(re.findall(r'(\d+)\D.*\D(\d+)岁', string)[0])
mdbq/spider/aikucun.py CHANGED
@@ -483,7 +483,7 @@ class AikuCunNew:
483
483
 
484
484
  if __name__ == '__main__':
485
485
  get_cookie_aikucun() # 登录并获取 cookies
486
- akucun(date_num=10, headless=True) # 下载数据
486
+ akucun(date_num=5, headless=True) # 下载数据
487
487
 
488
488
  # a = AikuCunNew(shop_name='aikucun')
489
489
  # a.akc()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 3.4.4
3
+ Version: 3.4.6
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -2,9 +2,9 @@ mdbq/__init__.py,sha256=Il5Q9ATdX8yXqVxtP_nYqUhExzxPC_qk_WXQ_4h0exg,16
2
2
  mdbq/__version__.py,sha256=y9Mp_8x0BCZSHsdLT_q5tX9wZwd5QgqrSIENLrb6vXA,62
3
3
  mdbq/aggregation/__init__.py,sha256=EeDqX2Aml6SPx8363J-v1lz0EcZtgwIBYyCJV6CcEDU,40
4
4
  mdbq/aggregation/aggregation.py,sha256=-yzApnlqSN2L0E1YMu5ml-W827qpKQvWPCOI7jj2kzY,80264
5
- mdbq/aggregation/datashow.py,sha256=XTIhjlbC8MUDAq1XnWXco-IfL31FJO0Kgw9z3QoM2Jc,53219
5
+ mdbq/aggregation/datashow.py,sha256=1AYSIDkdUx-4as1Ax2rPj0cExM9d-qFMrFYLAaPHNuk,54962
6
6
  mdbq/aggregation/optimize_data.py,sha256=RXIv7cACCgYyehAxMjUYi_S7rVyjIwXKWMaM3nduGtA,3068
7
- mdbq/aggregation/query_data.py,sha256=9NALeHTP9tblOEPyntLBRtdroLG_qN9qWi34Hg4rXFM,178891
7
+ mdbq/aggregation/query_data.py,sha256=CRbc4Lf-Ql3SBb9BY-0SdRQTlRDE1D4DG_3Tmx4483s,178890
8
8
  mdbq/bdup/__init__.py,sha256=AkhsGk81SkG1c8FqDH5tRq-8MZmFobVbN60DTyukYTY,28
9
9
  mdbq/bdup/bdup.py,sha256=LAV0TgnQpc-LB-YuJthxb0U42_VkPidzQzAagan46lU,4234
10
10
  mdbq/config/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
@@ -33,8 +33,8 @@ mdbq/pbix/pbix_refresh.py,sha256=JUjKW3bNEyoMVfVfo77UhguvS5AWkixvVhDbw4_MHco,239
33
33
  mdbq/pbix/refresh_all.py,sha256=OBT9EewSZ0aRS9vL_FflVn74d4l2G00wzHiikCC4TC0,5926
34
34
  mdbq/pbix/refresh_all_old.py,sha256=_pq3WSQ728GPtEG5pfsZI2uTJhU8D6ra-htIk1JXYzw,7192
35
35
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
36
- mdbq/spider/aikucun.py,sha256=v7VO5gtEXR6_4Q6ujbTyu1FHu7TXHcwSQ6hIO249YH0,22208
37
- mdbq-3.4.4.dist-info/METADATA,sha256=owU691dFqOy3Rv_GlFjck7sWdx5R8ZeFZkfkWtpJBcE,243
38
- mdbq-3.4.4.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
39
- mdbq-3.4.4.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
40
- mdbq-3.4.4.dist-info/RECORD,,
36
+ mdbq/spider/aikucun.py,sha256=zOacjrJ3MvToyuugA68xB-oN6RKj8K3GxMKudnln9EA,22207
37
+ mdbq-3.4.6.dist-info/METADATA,sha256=vkPu6J2sEW1O7DV1Q4eufPEKnbTsj0v5_1plFdfGj-k,243
38
+ mdbq-3.4.6.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
39
+ mdbq-3.4.6.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
40
+ mdbq-3.4.6.dist-info/RECORD,,
File without changes