ey-commerce-lib 1.0.23__py3-none-any.whl → 1.0.24__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 ey-commerce-lib might be problematic. Click here for more details.

@@ -23,4 +23,17 @@ EDIT_HEADERS = {
23
23
  'Referer': 'http://k5.takesend.com:8180/client/Logon?action=initMenu',
24
24
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
25
25
  'X-Requested-With': 'XMLHttpRequest',
26
- }
26
+ }
27
+
28
+ LIST_HEADS = {
29
+ 'Accept': '*/*',
30
+ 'Accept-Language': 'zh-CN,zh;q=0.9',
31
+ 'Cache-Control': 'no-cache',
32
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
33
+ 'Origin': 'http://k5.takesend.com:8180',
34
+ 'Pragma': 'no-cache',
35
+ 'Proxy-Connection': 'keep-alive',
36
+ 'Referer': 'http://k5.takesend.com:8180/client/Logon?action=initMenu',
37
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36',
38
+ 'X-Requested-With': 'XMLHttpRequest',
39
+ }
@@ -1,6 +1,7 @@
1
1
  from httpx import AsyncClient, Timeout
2
2
 
3
- from ey_commerce_lib.takesend.config import LOGIN_HEADERS, EDIT_HEADERS
3
+ from ey_commerce_lib.takesend.config import LOGIN_HEADERS, EDIT_HEADERS, LIST_HEADS
4
+ from ey_commerce_lib.takesend.parser.order import get_order_page, get_order_track_number_list
4
5
 
5
6
 
6
7
  class TakeSendClient(object):
@@ -50,6 +51,65 @@ class TakeSendClient(object):
50
51
  response = await self.__async_client.post('/Client/CCOrder', params=params, data=data, headers=EDIT_HEADERS)
51
52
  return response.json()
52
53
 
54
+ async def client_cc_order_list_by_pre_date(self, pageNum: int, pageSize: int, begeditdate: str, endeditdate: str):
55
+ """
56
+ 泰嘉已预报根据制单日期查询全部订单
57
+ :param pageNum:
58
+ :param pageSize:
59
+ :param begeditdate: 制单日期开始
60
+ :param endeditdate: 制单日期结束
61
+ :return:
62
+ """
63
+
64
+ # 访问首页刷新token
65
+ await self.__async_client.get('/client/Logon?action=initMenu')
66
+ params = {
67
+ 'action': 'list',
68
+ }
69
+ data = {
70
+ 'flag': '3',
71
+ 'pageNum1': '1',
72
+ 'numPerPage': '200',
73
+ 'orderField': '1',
74
+ 'orderDirection': 'asc',
75
+ 'corpbillid': '',
76
+ 'channelid': '',
77
+ 'orgLookup.country': '',
78
+ 'orgLookup.chinese': '',
79
+ 'printnum': '',
80
+ 'ordertype': 'CORDER',
81
+ 'buyerid': '',
82
+ 'mbflag': '',
83
+ 'houseid': '',
84
+ 'begeditdate': '2025-10-24 00:00:00',
85
+ 'endeditdate': '2025-10-24 23:50:50',
86
+ }
87
+ response = await self.__async_client.post('/Client/CCOrder', params=params, data=data)
88
+ return response.text
89
+
90
+ async def list_track_number_client_cc_order_list_by_pre_date(self, begeditdate: str, endeditdate: str):
91
+ """
92
+ 泰嘉已预报根据制单日期查询全部订单
93
+ :param begeditdate:
94
+ :param endeditdate:
95
+ :return:
96
+ """
97
+ # 遍历页码
98
+ page_info = get_order_page(
99
+ await self.client_cc_order_list_by_pre_date(pageNum=1, pageSize=200, begeditdate=begeditdate,
100
+ endeditdate=endeditdate))
101
+ total = page_info['total']
102
+ # 计算总页数
103
+ total_page = total // 200 + 1
104
+ track_number_list = []
105
+ for page in range(1, total_page + 1):
106
+ # 获取订单列表
107
+ page_html = await self.client_cc_order_list_by_pre_date(pageNum=page, pageSize=200, begeditdate=begeditdate,
108
+ endeditdate=endeditdate)
109
+ # 解析
110
+ track_number_list.extend(get_order_track_number_list(page_html))
111
+ return track_number_list
112
+
53
113
  async def __aenter__(self):
54
114
  return self
55
115
 
File without changes
@@ -0,0 +1,20 @@
1
+ from lxml import html
2
+
3
+
4
+ def get_order_track_number_list(html_str: str):
5
+ tree = html.fromstring(html_str)
6
+ track_number_element_list = tree.xpath('//div[@class="pageContent"]//tbody/tr[@target="sid_serialid"]/td[4]/text()')
7
+ track_number_list = []
8
+ for track_number_element in track_number_element_list:
9
+ track_number = track_number_element.strip()
10
+ if track_number:
11
+ track_number_list.append(track_number)
12
+ return track_number_list
13
+
14
+
15
+ def get_order_page(html_str: str):
16
+ tree = html.fromstring(html_str)
17
+ return {
18
+ 'total': int(tree.xpath('//div[@class="pagination"]/@totalcount')[0]),
19
+ 'page_size': int(tree.xpath('//div[@class="pagination"]/@numperpage')[0])
20
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ey-commerce-lib
3
- Version: 1.0.23
3
+ Version: 1.0.24
4
4
  Summary: eeyoung电商客户端调用封装
5
5
  Author-email: 饶奇奇 <1124393197@qq.com>
6
6
  Requires-Python: >=3.10
@@ -48,14 +48,16 @@ ey_commerce_lib/kogan/schemas/response/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
48
48
  ey_commerce_lib/kogan/schemas/response/order.py,sha256=ATWks8Erv9HmW9t_UklYRMn4sNbzYptmE8jTU_uCeyc,4718
49
49
  ey_commerce_lib/kogan/schemas/response/product.py,sha256=IVC1QSHSYZyHa4lCYz20rTdtmPvpPoqJsQP88hu48S4,2773
50
50
  ey_commerce_lib/takesend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
- ey_commerce_lib/takesend/config.py,sha256=doR1mzVL3hrDY8luVT1_hRIGAc2_ZaTgYS8-SBU__Js,1260
52
- ey_commerce_lib/takesend/main.py,sha256=x91ySyNfxUYQuuzKpA1hCW_IH7H9_Rxj-PTmYNwjs2g,1654
51
+ ey_commerce_lib/takesend/config.py,sha256=h-WRPE8_M0mDRM8SIs2bw-nd-HsiWjeRkk9NwjzYjOw,1819
52
+ ey_commerce_lib/takesend/main.py,sha256=8JHG3gDXefdFL6_i9U2iLH1Tcz3XtUSPqUyZoQJSjgY,4098
53
+ ey_commerce_lib/takesend/parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
+ ey_commerce_lib/takesend/parser/order.py,sha256=cDjRH5xBLZUD_rrsiRDyQ-2m_AcGK_pJunUTltVYwSI,747
53
55
  ey_commerce_lib/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
56
  ey_commerce_lib/utils/close.py,sha256=-De_H1I-gryytKYhLMsC3HfW67W852XkP1ckK2gLsFs,141
55
57
  ey_commerce_lib/utils/dxm.py,sha256=jVNltK_Pm_yMzXReD0Aw5VW6kzIZ5Bn23RucS0DKBI0,1196
56
58
  ey_commerce_lib/utils/float.py,sha256=PiOMf9pRApc1DskKkhKx0LAWHAYTpAPT_G4QRZRd8ZU,905
57
59
  ey_commerce_lib/utils/list_util.py,sha256=R1w7B1m3sEXr38zSHWp-15C3xAs5ykYCCpvwmnRW4xs,545
58
60
  ey_commerce_lib/utils/str.py,sha256=939xE0y8U7KEWjwbEezMlaWJNBsfb2BSb-dBpYbOD8Q,138
59
- ey_commerce_lib-1.0.23.dist-info/METADATA,sha256=SpR-HuS_lKn3GTuGWFvpa6fPyj7REejby7icmqLtQxc,391
60
- ey_commerce_lib-1.0.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
61
- ey_commerce_lib-1.0.23.dist-info/RECORD,,
61
+ ey_commerce_lib-1.0.24.dist-info/METADATA,sha256=4LFZRV75mzGIi2N3je6ka_xx3okyaog7p0UflqMwzZ8,391
62
+ ey_commerce_lib-1.0.24.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
63
+ ey_commerce_lib-1.0.24.dist-info/RECORD,,