qrpa 1.0.82__py3-none-any.whl → 1.0.83__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.

Potentially problematic release.


This version of qrpa might be problematic. Click here for more details.

qrpa/shein_mysql.py CHANGED
@@ -1,54 +1,62 @@
1
- import json
2
-
3
- from .mysql_module.shein_return_order_model import SheinReturnOrderManager
4
- from .mysql_module.shein_product_model import SheinProductManager
5
- from .fun_base import log
6
-
7
- class SheinMysql:
8
- def __init__(self, config):
9
- self.config = config
10
-
11
- def upsert_shein_return_order(self, json_file):
12
- log(f'当前使用的数据库: {self.config.db.database_url}')
13
- # 创建管理器实例
14
- manager = SheinReturnOrderManager(self.config.db.database_url)
15
- # 创建数据表
16
- manager.create_tables()
17
- # 读取JSON文件
18
- with open(json_file, 'r', encoding='utf-8') as f:
19
- dict = json.load(f)
20
- for store_username, data_list in dict.items():
21
- manager.upsert_return_order_data(store_username, data_list)
22
-
23
- def upsert_shein_product(self, json_file):
24
- log(f'当前使用的数据库: {self.config.db.database_url}')
25
- # 创建管理器实例
26
- manager = SheinProductManager(self.config.db.database_url)
27
- # 创建数据表
28
- manager.create_tables()
29
- with open(json_file, 'r', encoding='utf-8') as f:
30
- file_list = json.load(f)
31
- for store_username, store_skc_list_file in file_list.items():
32
- with open(store_skc_list_file, 'r', encoding='utf-8') as f:
33
- dict_store_skc_list = json.load(f)
34
- for store_username, data_list in dict_store_skc_list.items():
35
- manager.upsert_product_data(data_list)
36
-
37
- def upsert_shein_product_info(self, json_file):
38
- log(f'当前使用的数据库: {self.config.db.database_url}')
39
- # 创建管理器实例
40
- manager = SheinProductManager(self.config.db.database_url)
41
- # 创建数据表
42
- manager.create_tables()
43
- with open(json_file, 'r', encoding='utf-8') as f:
44
- file_list = json.load(f)
45
- for store_username, store_spu_list in file_list.items():
46
- for spu in store_spu_list:
47
- product_detail_file = f'{self.config.auto_dir}/shein/product_detail/product_detail_{spu}.json'
48
- attribute_file = f'{self.config.auto_dir}/shein/attribute/attribute_template_{spu}.json'
49
- with open(product_detail_file, 'r', encoding='utf-8') as f:
50
- data_list = json.load(f)
51
- manager.upsert_product_detail(spu, 'product_detail', data_list)
52
- with open(attribute_file, 'r', encoding='utf-8') as f:
53
- data_list = json.load(f)
54
- manager.upsert_product_detail(spu, 'attribute_template', data_list)
1
+ import json
2
+
3
+ from .mysql_module.shein_return_order_model import SheinReturnOrderManager
4
+ from .mysql_module.shein_product_model import SheinProductManager
5
+ from .fun_base import log
6
+
7
+ import os
8
+
9
+ class SheinMysql:
10
+ def __init__(self, config):
11
+ self.config = config
12
+
13
+ def upsert_shein_return_order(self, json_file):
14
+ log(f'当前使用的数据库: {self.config.db.database_url}')
15
+ # 创建管理器实例
16
+ manager = SheinReturnOrderManager(self.config.db.database_url)
17
+ # 创建数据表
18
+ manager.create_tables()
19
+ # 读取JSON文件
20
+ with open(json_file, 'r', encoding='utf-8') as f:
21
+ dict = json.load(f)
22
+ for store_username, data_list in dict.items():
23
+ manager.upsert_return_order_data(store_username, data_list)
24
+
25
+ def upsert_shein_product(self, json_file):
26
+ log(f'当前使用的数据库: {self.config.db.database_url}')
27
+ # 创建管理器实例
28
+ manager = SheinProductManager(self.config.db.database_url)
29
+ # 创建数据表
30
+ manager.create_tables()
31
+ with open(json_file, 'r', encoding='utf-8') as f:
32
+ file_list = json.load(f)
33
+ for store_username, store_skc_list_file in file_list.items():
34
+ with open(store_skc_list_file, 'r', encoding='utf-8') as f:
35
+ dict_store_skc_list = json.load(f)
36
+ for store_username, data_list in dict_store_skc_list.items():
37
+ manager.upsert_product_data(data_list)
38
+
39
+ def upsert_shein_product_info(self, json_file):
40
+ log(f'当前使用的数据库: {self.config.db.database_url}')
41
+ # 创建管理器实例
42
+ manager = SheinProductManager(self.config.db.database_url)
43
+ # 创建数据表
44
+ manager.create_tables()
45
+ with open(json_file, 'r', encoding='utf-8') as f:
46
+ file_list = json.load(f)
47
+ for store_username, store_spu_list in file_list.items():
48
+ for spu in store_spu_list:
49
+ product_detail_file = f'{self.config.auto_dir}/shein/product_detail/product_detail_{spu}.json'
50
+ attribute_file = f'{self.config.auto_dir}/shein/attribute/attribute_template_{spu}.json'
51
+ if os.path.exists(product_detail_file):
52
+ with open(product_detail_file, 'r', encoding='utf-8') as f:
53
+ data_list = json.load(f)
54
+ manager.upsert_product_detail(spu, 'product_detail', data_list)
55
+ else:
56
+ log(f'文件不存在: {product_detail_file}')
57
+ if os.path.exists(attribute_file):
58
+ with open(attribute_file, 'r', encoding='utf-8') as f:
59
+ data_list = json.load(f)
60
+ manager.upsert_product_detail(spu, 'attribute_template', data_list)
61
+ else:
62
+ log(f'文件不存在: {attribute_file}')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.0.82
3
+ Version: 1.0.83
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
@@ -12,7 +12,7 @@ qrpa/fun_win.py,sha256=-LnTeocdTt72NVH6VgLdpAT9_C5oV9okeudXG6CftMA,8034
12
12
  qrpa/shein_daily_report_model.py,sha256=H8oZmIN5Pyqe306W1_xuz87lOqLQ_LI5RjXbaxDkIzE,12589
13
13
  qrpa/shein_excel.py,sha256=1F9QMMsaihDfwr0ajSSQdXksBCjuKSPwMynfP7Jlkso,124825
14
14
  qrpa/shein_lib.py,sha256=DULi8q93YZAQM9JcRhAzU_x3jph5XALifTtjs8wR_rQ,127342
15
- qrpa/shein_mysql.py,sha256=SrgBYPNWaKHIpD5Q7hqz3GWvytXO8u9SPvKxJvLwYsI,2720
15
+ qrpa/shein_mysql.py,sha256=Sgz6U0_3f4cT5zPf1Ht1OjvSFhrVPLkMxt91NV-ZPCM,3005
16
16
  qrpa/shein_sqlite.py,sha256=ZQwD0Gz81q9WY7tY2HMEYvSF9r3N_G_Aur3bYfST9WY,5707
17
17
  qrpa/shein_ziniao.py,sha256=3PvoRK-J81q5vhNXdhJ_OODExXPrPfJzTgYBH1S4rxM,18703
18
18
  qrpa/temu_chrome.py,sha256=CbtFy1QPan9xJdJcNZj-EsVGhUvv3ZTEPVDEA4-im40,2803
@@ -24,7 +24,7 @@ qrpa/wxwork.py,sha256=gIytG19DZ5g7Tsl0-W3EbjfSnpIqZw-ua24gcB78YEg,11264
24
24
  qrpa/mysql_module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  qrpa/mysql_module/shein_product_model.py,sha256=qViI_Ik3SkXXxqJ1nXjimvfB_a5uiwW9RXL0fOreBao,18880
26
26
  qrpa/mysql_module/shein_return_order_model.py,sha256=Zt-bGOH_kCDbakW7uaTmqqo_qTT8v424yidcYSfWvWM,26562
27
- qrpa-1.0.82.dist-info/METADATA,sha256=9X9XhzlvYOeFklMhLvVH9mZrFgvt28p5pdQZFR95T_w,231
28
- qrpa-1.0.82.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
- qrpa-1.0.82.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
30
- qrpa-1.0.82.dist-info/RECORD,,
27
+ qrpa-1.0.83.dist-info/METADATA,sha256=brK8XAHlG6imj368savaptLiIhL4apoKKnGw-sG-kfQ,231
28
+ qrpa-1.0.83.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ qrpa-1.0.83.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
30
+ qrpa-1.0.83.dist-info/RECORD,,
File without changes