mdbq 2.1.3__tar.gz → 2.1.4__tar.gz
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.
- {mdbq-2.1.3 → mdbq-2.1.4}/PKG-INFO +1 -1
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/company/copysh.py +10 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/other/sku_picture.py +23 -11
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq.egg-info/PKG-INFO +1 -1
- {mdbq-2.1.3 → mdbq-2.1.4}/setup.py +1 -1
- {mdbq-2.1.3 → mdbq-2.1.4}/README.txt +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/__version__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/aggregation/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/aggregation/aggregation.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/aggregation/df_types.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/aggregation/mysql_types.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/aggregation/optimize_data.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/aggregation/query_data.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/bdup/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/bdup/bdup.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/clean/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/clean/data_clean.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/company/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/company/home_sh.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/config/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/config/get_myconf.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/config/products.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/config/set_support.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/config/update_conf.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/dataframe/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/dataframe/converter.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/log/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/log/mylogger.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/mongo/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/mongo/mongo.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/mysql/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/mysql/mysql.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/mysql/s_query.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/mysql/year_month_day.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/other/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/other/porxy.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/other/pov_city.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/other/ua_sj.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/pbix/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/pbix/pbix_refresh.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/pbix/refresh_all.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq/spider/__init__.py +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq.egg-info/SOURCES.txt +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq.egg-info/dependency_links.txt +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/mdbq.egg-info/top_level.txt +0 -0
- {mdbq-2.1.3 → mdbq-2.1.4}/setup.cfg +0 -0
@@ -21,6 +21,7 @@ from mdbq.config import set_support
|
|
21
21
|
from mdbq.config import products
|
22
22
|
from mdbq.mysql import mysql
|
23
23
|
from mdbq.pbix import refresh_all
|
24
|
+
from mdbq.other import sku_picture
|
24
25
|
warnings.filterwarnings('ignore')
|
25
26
|
|
26
27
|
|
@@ -361,6 +362,15 @@ def main():
|
|
361
362
|
dp.upload_df(service_databases=[{'company': 'mysql'}])
|
362
363
|
dp.date_table(service_databases=[{'company': 'mysql'}]) # 因为日期表不受 days 参数控制,因此单独更新日期表
|
363
364
|
dp.other_table(service_databases=[{'company': 'mysql'}]) # 上传 support 文件夹下的 主推商品.csv
|
365
|
+
if datetime.datetime.now().day in [1, 3, 7, 9, 12, 16, 19, 22, 25, 27]:
|
366
|
+
sku_picture.download_spu(
|
367
|
+
service_name='company',
|
368
|
+
database='mysql',
|
369
|
+
db_name='属性设置2',
|
370
|
+
table_name='商品spu素材下载记录',
|
371
|
+
col_name='商品图片',
|
372
|
+
save_path=os.path.join(f'\\\\192.168.1.198\\时尚事业部\\01.运营部\\天猫报表\\其他文件', '商品id_商家编码_图片'),
|
373
|
+
)
|
364
374
|
|
365
375
|
# 此操作用于修改 .copysh_conf 文件,将 ch_record 改为 false (更新完成)
|
366
376
|
w = update_conf.UpdateConf()
|
@@ -28,8 +28,13 @@ import io
|
|
28
28
|
from openpyxl import load_workbook
|
29
29
|
from openpyxl.drawing.image import Image
|
30
30
|
from openpyxl.utils import get_column_letter
|
31
|
+
from setuptools.sandbox import save_path
|
31
32
|
|
32
33
|
warnings.filterwarnings('ignore')
|
34
|
+
"""
|
35
|
+
用来下载商品spu/sku图片素材
|
36
|
+
"""
|
37
|
+
|
33
38
|
|
34
39
|
if platform.system() == 'Windows':
|
35
40
|
D_PATH = os.path.normpath(f'C:\\Users\\{getpass.getuser()}\\Downloads')
|
@@ -502,10 +507,8 @@ class DownloadPicture():
|
|
502
507
|
self.download = s_query.QueryDatas(username=username, password=password, host=host, port=port)
|
503
508
|
self.df = pd.DataFrame()
|
504
509
|
self.headers = {'User-Agent': ua_sj.get_ua()}
|
505
|
-
self.save_path =
|
510
|
+
self.save_path = None
|
506
511
|
self.filename = ''
|
507
|
-
if not os.path.exists(self.save_path):
|
508
|
-
os.mkdir(self.save_path)
|
509
512
|
self.local_file = ''
|
510
513
|
self.finish_download = []
|
511
514
|
|
@@ -532,8 +535,8 @@ class DownloadPicture():
|
|
532
535
|
self.df = pd.read_excel(self.local_file, header=0, engine='openpyxl')
|
533
536
|
|
534
537
|
def download_data(self):
|
535
|
-
if not os.path.exists(self.save_path):
|
536
|
-
|
538
|
+
# if not os.path.exists(self.save_path):
|
539
|
+
# os.mkdir(self.save_path)
|
537
540
|
dict_data = self.df.to_dict('records')
|
538
541
|
num = len(dict_data)
|
539
542
|
i = 0
|
@@ -557,7 +560,8 @@ class DownloadPicture():
|
|
557
560
|
i += 1
|
558
561
|
time.sleep(0.5)
|
559
562
|
|
560
|
-
def download_data_from_local(self, col_name='sku图片链接'):
|
563
|
+
def download_data_from_local(self, col_name='sku图片链接', save_path=os.path.join(D_PATH, 'sku图片链接')):
|
564
|
+
self.save_path = save_path
|
561
565
|
if not os.path.exists(self.save_path):
|
562
566
|
os.mkdir(self.save_path)
|
563
567
|
dict_data = self.df.to_dict('records')
|
@@ -583,7 +587,8 @@ class DownloadPicture():
|
|
583
587
|
i += 1
|
584
588
|
time.sleep(0.5)
|
585
589
|
|
586
|
-
def download_from_df(self, col_name='商品图片'):
|
590
|
+
def download_from_df(self, col_name='商品图片', save_path=os.path.join(D_PATH, '商品id_商家编码_图片')):
|
591
|
+
self.save_path = save_path
|
587
592
|
if not os.path.exists(self.save_path):
|
588
593
|
os.mkdir(self.save_path)
|
589
594
|
dict_data = self.df.to_dict('records')
|
@@ -914,7 +919,7 @@ def download_sku(service_name='company', database='mysql', db_name='属性设置
|
|
914
919
|
) # 3. 回传数据库
|
915
920
|
|
916
921
|
|
917
|
-
def download_spu(service_name='company', database='mysql', db_name='属性设置2', table_name='商品spu素材下载记录', col_name='商品图片'):
|
922
|
+
def download_spu(service_name='company', database='mysql', db_name='属性设置2', table_name='商品spu素材下载记录', col_name='商品图片', save_path=os.path.join(D_PATH, '商品id_商家编码_图片')):
|
918
923
|
"""
|
919
924
|
|
920
925
|
"""
|
@@ -1008,10 +1013,10 @@ def download_spu(service_name='company', database='mysql', db_name='属性设置
|
|
1008
1013
|
if len(df) > 0:
|
1009
1014
|
# 5. 实例化一个下载器类,并下载数据
|
1010
1015
|
d = DownloadPicture(service_name=service_name)
|
1011
|
-
d.save_path =
|
1016
|
+
d.save_path = save_path # 下载图片到本地时的存储位置
|
1012
1017
|
d.filename = f'{db_name}_{table_name}.xlsx'
|
1013
1018
|
d.df = df
|
1014
|
-
d.download_from_df(col_name=col_name)
|
1019
|
+
d.download_from_df(col_name=col_name, save_path=save_path)
|
1015
1020
|
df['获取与下载'] = df.apply(lambda x: '已下载' if x['商品id'] in d.finish_download else x['获取与下载'], axis=1)
|
1016
1021
|
|
1017
1022
|
# 6. 回传数据库
|
@@ -1035,4 +1040,11 @@ if __name__ == '__main__':
|
|
1035
1040
|
# main2(service_name='home_lx', database='mysql')
|
1036
1041
|
# main3()
|
1037
1042
|
# download_sku(service_name='company', database='mysql', db_name='属性设置2', table_name='商品素材下载记录')
|
1038
|
-
download_spu(
|
1043
|
+
download_spu(
|
1044
|
+
service_name='company',
|
1045
|
+
database='mysql',
|
1046
|
+
db_name='属性设置2',
|
1047
|
+
table_name='商品spu素材下载记录',
|
1048
|
+
col_name='商品图片',
|
1049
|
+
save_path=os.path.join(D_PATH, '1商品id_商家编码_图片'),
|
1050
|
+
)
|
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
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|