qrpa 1.0.81__tar.gz → 1.0.83__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.
Potentially problematic release.
This version of qrpa might be problematic. Click here for more details.
- {qrpa-1.0.81 → qrpa-1.0.83}/PKG-INFO +1 -1
- {qrpa-1.0.81 → qrpa-1.0.83}/pyproject.toml +1 -1
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/shein_lib.py +21 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/shein_mysql.py +62 -54
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa.egg-info/PKG-INFO +1 -1
- {qrpa-1.0.81 → qrpa-1.0.83}/README.md +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/RateLimitedSender.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/__init__.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/db_migrator.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/feishu_bot_app.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/feishu_client.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/feishu_logic.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/fun_base.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/fun_excel.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/fun_file.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/fun_web.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/fun_win.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/mysql_module/__init__.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/mysql_module/shein_product_model.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/mysql_module/shein_return_order_model.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/shein_daily_report_model.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/shein_excel.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/shein_sqlite.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/shein_ziniao.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/temu_chrome.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/temu_excel.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/temu_lib.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/time_utils.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/time_utils_example.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa/wxwork.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa.egg-info/SOURCES.txt +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa.egg-info/dependency_links.txt +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/qrpa.egg-info/top_level.txt +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/setup.cfg +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/setup.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/tests/test_db_migrator.py +0 -0
- {qrpa-1.0.81 → qrpa-1.0.83}/tests/test_wxwork.py +0 -0
|
@@ -629,6 +629,19 @@ class SheinLib:
|
|
|
629
629
|
log(f'正在获取 {self.store_name} 最近一个月出库金额: {last_item["totalCustomerAmount"]}')
|
|
630
630
|
return last_item['totalCustomerAmount']
|
|
631
631
|
|
|
632
|
+
def query_attribute_multi(self, attribute_id_list):
|
|
633
|
+
url = "https://sso.geiwohuo.com/spmp-api-prefix/spmp/attribute/query_attribute_multi"
|
|
634
|
+
payload = {
|
|
635
|
+
"attribute_id_list": attribute_id_list,
|
|
636
|
+
}
|
|
637
|
+
response_text = fetch(self.web_page, url, payload)
|
|
638
|
+
error_code = response_text.get('code')
|
|
639
|
+
if str(error_code) != '0':
|
|
640
|
+
raise send_exception(json.dumps(response_text, ensure_ascii=False))
|
|
641
|
+
info = response_text.get('info')
|
|
642
|
+
lst = info.get('data', {})
|
|
643
|
+
return lst
|
|
644
|
+
|
|
632
645
|
def get_product_attr(self, spu, attr_name):
|
|
633
646
|
try:
|
|
634
647
|
product_detail = self.get_product_detail(spu)
|
|
@@ -706,6 +719,14 @@ class SheinLib:
|
|
|
706
719
|
if str(error_code) != '0':
|
|
707
720
|
raise send_exception(json.dumps(response_text, ensure_ascii=False))
|
|
708
721
|
info = response_text.get('info')
|
|
722
|
+
|
|
723
|
+
# 获取 area_attribute_id
|
|
724
|
+
sample_sku_back_size = info.get('sample_sku_back_size', None)
|
|
725
|
+
if sample_sku_back_size is not None:
|
|
726
|
+
area_attribute_ids = [item['area_attribute_id'] for item in sample_sku_back_size.get('area_info_list', [])]
|
|
727
|
+
attribute_multi = self.query_attribute_multi(area_attribute_ids)
|
|
728
|
+
info["attribute_multi"] = attribute_multi
|
|
729
|
+
|
|
709
730
|
write_dict_to_file(cache_file, info)
|
|
710
731
|
return info
|
|
711
732
|
|
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
manager.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
manager.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
#
|
|
42
|
-
manager.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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}')
|
|
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
|