ey-commerce-lib 1.0.11__tar.gz → 1.0.12__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 ey-commerce-lib might be problematic. Click here for more details.

Files changed (58) hide show
  1. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/PKG-INFO +1 -1
  2. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/pyproject.toml +1 -1
  3. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/main.py +2 -1
  4. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/parser/common.py +2 -1
  5. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/parser/order.py +15 -12
  6. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/parser/purchase.py +0 -1
  7. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/parser/warehouse.py +4 -2
  8. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/schemas/order.py +4 -1
  9. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/schemas/warehouse.py +3 -4
  10. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/main.py +1 -1
  11. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/schemas/vo/order.py +1 -0
  12. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/schemas/query/product.py +1 -0
  13. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/schemas/response/order.py +3 -2
  14. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/schemas/response/product.py +2 -1
  15. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/model.py +1 -0
  16. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/tests/dxm/test_purchase.py +8 -1
  17. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/.gitignore +0 -0
  18. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/.python-version +0 -0
  19. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/README.md +0 -0
  20. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/pytest.ini +0 -0
  21. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/__init__.py +0 -0
  22. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/__init__.py +0 -0
  23. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/constant/__init__.py +0 -0
  24. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/constant/order.py +0 -0
  25. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/exception/__init__.py +0 -0
  26. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/exception/common.py +0 -0
  27. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/order.py +0 -0
  28. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/parser/__init__.py +0 -0
  29. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/schemas/__init__.py +0 -0
  30. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/schemas/common.py +0 -0
  31. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/utils/__init__.py +0 -0
  32. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/dxm/utils/mark.py +0 -0
  33. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/__init__.py +0 -0
  34. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/constant/__init__.py +0 -0
  35. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/constant/response.py +0 -0
  36. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/parser/__init__.py +0 -0
  37. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/parser/order.py +0 -0
  38. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/schemas/__init__.py +0 -0
  39. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/schemas/query/__init__.py +0 -0
  40. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/schemas/query/order.py +0 -0
  41. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/four_seller/schemas/vo/__init__.py +0 -0
  42. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/__init__.py +0 -0
  43. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/main.py +0 -0
  44. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/schemas/__init__.py +0 -0
  45. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/schemas/query/__init__.py +0 -0
  46. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/schemas/query/order.py +0 -0
  47. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/kogan/schemas/response/__init__.py +0 -0
  48. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/py.typed +0 -0
  49. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/utils/__init__.py +0 -0
  50. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/utils/close.py +0 -0
  51. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/utils/dxm.py +0 -0
  52. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/utils/list_util.py +0 -0
  53. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/src/ey_commerce_lib/utils/str.py +0 -0
  54. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/tests/__init__.py +0 -0
  55. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/tests/dxm/__init__.py +0 -0
  56. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/tests/kogan/__init__.py +0 -0
  57. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/tests/kogan/test_client.py +0 -0
  58. {ey_commerce_lib-1.0.11 → ey_commerce_lib-1.0.12}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ey-commerce-lib
3
- Version: 1.0.11
3
+ Version: 1.0.12
4
4
  Summary: eeyoung电商客户端调用封装
5
5
  Author-email: 饶奇奇 <1124393197@qq.com>
6
6
  Requires-Python: >=3.10
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ey-commerce-lib"
3
- version = "1.0.11"
3
+ version = "1.0.12"
4
4
  description = "eeyoung电商客户端调用封装"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1,5 +1,7 @@
1
1
  import asyncio
2
2
 
3
+ from httpx import AsyncClient, Timeout
4
+
3
5
  from ey_commerce_lib.dxm.constant.order import DxmOrderRuleType
4
6
  from ey_commerce_lib.dxm.parser.common import get_page_info, get_purchase_pagination_info
5
7
  from ey_commerce_lib.dxm.parser.order import list_order_base_by_html, list_order_rule, get_rule_detail, \
@@ -10,7 +12,6 @@ from ey_commerce_lib.dxm.parser.warehouse import list_warehouse_product
10
12
  from ey_commerce_lib.dxm.schemas.common import Page
11
13
  from ey_commerce_lib.dxm.schemas.order import DxmOrderSearchForm, DxmJsonResponse, DxmCheckProcessResponse, DxmOrderRule
12
14
  from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProduct, WarehouseProductQuery, PurchasingAllQuery
13
- from httpx import AsyncClient, Timeout
14
15
 
15
16
 
16
17
  class DxmClient:
@@ -1,9 +1,10 @@
1
1
  import re
2
2
  from typing import TypedDict
3
3
 
4
- from ey_commerce_lib.dxm.exception.common import PageInfoNotFoundException
5
4
  from lxml import html
6
5
 
6
+ from ey_commerce_lib.dxm.exception.common import PageInfoNotFoundException
7
+
7
8
 
8
9
  class PageInfo(TypedDict):
9
10
  page_size: int
@@ -1,9 +1,10 @@
1
1
  import re
2
2
 
3
+ from lxml import html
4
+
3
5
  from ey_commerce_lib.dxm.schemas.order import DxmOrderRule, DxmOrderRuleCond, DxmOrderReviewRule, DxmOrderLogisticsRule
4
6
  from ey_commerce_lib.utils.dxm import get_remaining_ship_time, get_data_custom_mark_to_str
5
7
  from ey_commerce_lib.utils.list_util import get_str_list_first_not_blank_or_none
6
- from lxml import html
7
8
 
8
9
 
9
10
  def get_single_order_item_list(order_element: html.HtmlElement):
@@ -230,11 +231,11 @@ def get_rule_detail(html_str: str) -> DxmOrderRule:
230
231
  cond_list = list()
231
232
  # 获取规则的条件
232
233
  for cond_element in cond_element_list:
233
- cond_val = cond_element.xpath('./input[@name="condVal"]/@value')[0]
234
- cond_id = cond_element.xpath('./input[@name="condId"]/@value')[0]
235
- cond_name = cond_element.xpath('./input[@name="condName"]/@value')[0]
236
- cond_unit = cond_element.xpath('./input[@name="condUnit"]/@value')[0]
237
- cond_type = cond_element.xpath('./input[@name="condType"]/@value')[0]
234
+ cond_val = cond_element.xpath('.//input[@name="condVal"]/@value')[0]
235
+ cond_id = cond_element.xpath('.//input[@name="condId"]/@value')[0]
236
+ cond_name = cond_element.xpath('.//input[@name="condName"]/@value')[0]
237
+ cond_unit = cond_element.xpath('.//input[@name="condUnit"]/@value')[0]
238
+ cond_type = cond_element.xpath('.//input[@name="condType"]/@value')[0]
238
239
  cond_list.append(DxmOrderRuleCond(cond_val=cond_val,
239
240
  cond_id=cond_id,
240
241
  cond_name=cond_name,
@@ -245,10 +246,11 @@ def get_rule_detail(html_str: str) -> DxmOrderRule:
245
246
  rule_id = tree.xpath('//input[@name="id"]/@value')[0]
246
247
  rule_type = tree.xpath('//input[@name="type"]/@value')[0]
247
248
  rule_name = tree.xpath('//input[@id="ruleName"]/@value')[0]
249
+ gift_doubly = tree.xpath('//input[@id="giftDoubly"]/@value')[0]
248
250
 
249
- kfbz = get_str_list_first_not_blank_or_none(tree.xpath('//textarea[@name="kfbz"]/text()'))
250
- jhbz = get_str_list_first_not_blank_or_none(tree.xpath('//textarea[@name="jhbz"]/@value'))
251
- jh_color = tree.xpath('//a[contains(@class, "bgCommentFocus")]/@data-val')[0]
251
+ kfbz = get_str_list_first_not_blank_or_none(tree.xpath('//textarea[@name="kfbz"]/text()')) or ''
252
+ jhbz = get_str_list_first_not_blank_or_none(tree.xpath('//textarea[@name="jhbz"]/text()')) or ''
253
+ jh_color = tree.xpath('//input[@id="jhColor"]/@value')[0]
252
254
  other_action_checked_list = tree.xpath('//input[@name="otherAction"]/@checked')
253
255
  other_action = 'on' if len(other_action_checked_list) > 0 else ''
254
256
  custom_mark = tree.xpath('//div[contains(@class, "customMarkRuleEl")]/@data-custom-mark')[0]
@@ -267,9 +269,9 @@ def get_rule_detail(html_str: str) -> DxmOrderRule:
267
269
  auth_ids = tree.xpath('//input[@name="authIds"]/@value')[0]
268
270
  pattern = re.compile(r"if\s*\(\s*'(\d+)'\s*===\s*item\.idStr")
269
271
  auth_id = pattern.findall(html_str)[0]
270
-
271
272
  # 物流规则
272
- dxm_rule_order = DxmOrderLogisticsRule(dxm_cond_list=cond_list, id=rule_id, type=rule_type,
273
+ dxm_rule_order = DxmOrderLogisticsRule(gift_doubly=gift_doubly, dxm_cond_list=cond_list, id=rule_id,
274
+ type=rule_type,
273
275
  rule_name=rule_name, kfbz=kfbz, jhbz=jhbz,
274
276
  jh_color=jh_color, other_action=other_action,
275
277
  custom_mark=get_data_custom_mark_to_str(custom_mark),
@@ -278,7 +280,8 @@ def get_rule_detail(html_str: str) -> DxmOrderRule:
278
280
  )
279
281
  else:
280
282
  action = tree.xpath('//input[@name="action"]/@value')[0]
281
- dxm_rule_order = DxmOrderReviewRule(dxm_cond_list=cond_list, id=rule_id, type=rule_type,
283
+ dxm_rule_order = DxmOrderReviewRule(gift_doubly=gift_doubly, dxm_cond_list=cond_list, id=rule_id,
284
+ type=rule_type,
282
285
  rule_name=rule_name, kfbz=kfbz, jhbz=jhbz,
283
286
  jh_color=jh_color, other_action=other_action,
284
287
  custom_mark=get_data_custom_mark_to_str(custom_mark),
@@ -1,4 +1,3 @@
1
- import lxml.html
2
1
  from lxml import html
3
2
 
4
3
  from ey_commerce_lib.utils.list_util import get_str_list_first_not_blank_or_none
@@ -1,8 +1,10 @@
1
- from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProduct
2
1
  from lxml import html
3
2
 
3
+ from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProduct
4
+
4
5
 
5
6
  def __get_warehouse_product_by_xpath_element(warehouse_product_element: html.HtmlElement) -> WarehouseProduct:
7
+ proid = warehouse_product_element.xpath('.//input[@iptid="selectSingle"]/@data-proid')[0].strip()
6
8
  sku = warehouse_product_element.xpath('.//span[contains(@class, "productSku")]/text()')[0].strip()
7
9
  name_list = warehouse_product_element.xpath('.//p[contains(@class, "name")]/text()')
8
10
  name = name_list[0].strip() if len(name_list) > 0 else ''
@@ -49,7 +51,7 @@ def __get_warehouse_product_by_xpath_element(warehouse_product_element: html.Htm
49
51
  update_time = warehouse_product_element.xpath('./td[7]/div[1]/text()')[0]
50
52
  # 创建时间
51
53
  create_time = warehouse_product_element.xpath('./td[7]/div[2]/text()')[0]
52
- return WarehouseProduct(sku=sku, name=name, sku_code=sku_code, img=img, shelf_position=shelf_position,
54
+ return WarehouseProduct(proid=proid, sku=sku, name=name, sku_code=sku_code, img=img, shelf_position=shelf_position,
53
55
  safe_stock=safe_stock, on_the_way_stock=on_the_way_stock,
54
56
  not_shipped_stock=not_shipped_stock, occupy_stock=occupy_stock,
55
57
  available_stock=available_stock, total_stock=total_stock, price=price,
@@ -1,9 +1,10 @@
1
1
  from typing import TypedDict, Optional
2
2
  from urllib.parse import urlencode
3
3
 
4
- from ey_commerce_lib.utils.str import to_camel
5
4
  from pydantic import BaseModel, ConfigDict
6
5
 
6
+ from ey_commerce_lib.utils.str import to_camel
7
+
7
8
 
8
9
  class DxmOrderSearchForm(BaseModel):
9
10
  """
@@ -176,6 +177,7 @@ class DxmOrderRule(BaseModel):
176
177
  """
177
178
  店小秘订单规则参数基类
178
179
  """
180
+ gift_doubly: str
179
181
  # 规则id
180
182
  id: str
181
183
  # 规则类型(1:审单规则,2:物流规则)
@@ -200,6 +202,7 @@ class DxmOrderRule(BaseModel):
200
202
  data = list()
201
203
  data.append(('id', self.id))
202
204
  data.append(('type', self.type))
205
+ data.append(('giftDoubly', self.gift_doubly))
203
206
  data.append(('ruleName', self.rule_name))
204
207
  # 装填规则内容
205
208
  for cond in self.dxm_cond_list:
@@ -1,8 +1,9 @@
1
1
  from typing import Optional
2
2
 
3
- from ey_commerce_lib.utils.str import to_camel
4
3
  from pydantic import BaseModel, ConfigDict
5
4
 
5
+ from ey_commerce_lib.utils.str import to_camel
6
+
6
7
 
7
8
  class WarehouseProductQuery(BaseModel):
8
9
  refresh_flag: str = ''
@@ -67,6 +68,7 @@ class WarehouseProductQuery(BaseModel):
67
68
 
68
69
 
69
70
  class WarehouseProduct(BaseModel):
71
+ proid: str
70
72
  sku: str
71
73
  name: Optional[str] = None
72
74
  sku_code: str
@@ -160,6 +162,3 @@ class PurchasingAllQuery(BaseModel):
160
162
  alias_generator=to_camel,
161
163
  populate_by_name=True
162
164
  )
163
-
164
-
165
-
@@ -3,9 +3,9 @@ import base64
3
3
  import logging
4
4
  from typing import Callable
5
5
 
6
+ import ddddocr
6
7
  from httpx import AsyncClient, ReadTimeout
7
8
  from playwright.async_api import async_playwright, TimeoutError
8
- import ddddocr
9
9
 
10
10
  from ey_commerce_lib.four_seller.constant.response import ResponseCodeEnum
11
11
  from ey_commerce_lib.four_seller.parser.order import parse_order
@@ -1,4 +1,5 @@
1
1
  from typing import Optional
2
+
2
3
  from pydantic import BaseModel, Field, ConfigDict
3
4
 
4
5
 
@@ -1,4 +1,5 @@
1
1
  from typing import Optional
2
+
2
3
  from pydantic import BaseModel, Field, ConfigDict
3
4
 
4
5
 
@@ -1,6 +1,7 @@
1
- from pydantic import BaseModel, Field
2
- from typing import Optional
3
1
  from datetime import datetime
2
+ from typing import Optional
3
+
4
+ from pydantic import BaseModel, Field
4
5
 
5
6
 
6
7
  class AddressModel(BaseModel):
@@ -1,6 +1,7 @@
1
- from pydantic import BaseModel, Field, ConfigDict
2
1
  from typing import Optional
3
2
 
3
+ from pydantic import BaseModel, Field, ConfigDict
4
+
4
5
 
5
6
  class OfferDetail(BaseModel):
6
7
  # 价格
@@ -1,4 +1,5 @@
1
1
  from typing import Generic, TypeVar
2
+
2
3
  from pydantic import BaseModel
3
4
 
4
5
  T = TypeVar('T')
@@ -4,6 +4,7 @@ from ey_commerce_lib.dxm.constant.order import ORDER_SEARCH_APPROVAL_BASE_FORM,
4
4
  ORDER_SEARCH_PENDING_PROCESSING_BASE_FORM, ORDER_SEARCH_SELF_WAREHOUSE_BASE_FORM, \
5
5
  ORDER_SEARCH_OUT_OF_STOCK_BASE_FORM
6
6
  from ey_commerce_lib.dxm.main import DxmClient
7
+ from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProductQuery
7
8
  from ey_commerce_lib.dxm.utils.mark import get_custom_mark_content_list_by_data_custom_mark, \
8
9
  generate_add_or_update_user_comment_data_by_content_list
9
10
  from ey_commerce_lib.four_seller.main import FourSellerClient
@@ -39,4 +40,10 @@ headers = {
39
40
  @pytest.mark.asyncio
40
41
  async def test_dxm_api():
41
42
  async with (DxmClient(headers=headers, cookies=cookies) as dxm_client):
42
- pass
43
+ pass
44
+
45
+
46
+ @pytest.mark.asyncio
47
+ async def test_warehouse():
48
+ async with (DxmClient(headers=headers, cookies=cookies) as dxm_client):
49
+ print(await dxm_client.page_warehouse_product(WarehouseProductQuery()))