ey-commerce-lib 1.0.20__tar.gz → 1.0.22__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 (69) hide show
  1. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/PKG-INFO +1 -1
  2. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/pyproject.toml +1 -1
  3. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/main.py +34 -2
  4. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/order.py +30 -1
  5. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/main.py +1 -1
  6. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/takesend/main.py +12 -7
  7. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/tests/dxm/test_purchase.py +7 -2
  8. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/.gitignore +0 -0
  9. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/.python-version +0 -0
  10. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/README.md +0 -0
  11. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/pytest.ini +0 -0
  12. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/__init__.py +0 -0
  13. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/__init__.py +0 -0
  14. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/constant/__init__.py +0 -0
  15. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/constant/order.py +0 -0
  16. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/exception/__init__.py +0 -0
  17. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/exception/common.py +0 -0
  18. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/order.py +0 -0
  19. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/__init__.py +0 -0
  20. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/common.py +0 -0
  21. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/count.py +0 -0
  22. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/ebay_product.py +0 -0
  23. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/purchase.py +0 -0
  24. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/tracking.py +0 -0
  25. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/parser/warehouse.py +0 -0
  26. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/schemas/__init__.py +0 -0
  27. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/schemas/common.py +0 -0
  28. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/schemas/dxm_commodity_product.py +0 -0
  29. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/schemas/ebay_product.py +0 -0
  30. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/schemas/order.py +0 -0
  31. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/schemas/tracking.py +0 -0
  32. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/schemas/warehouse.py +0 -0
  33. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/utils/__init__.py +0 -0
  34. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/utils/dxm_commodity_product.py +0 -0
  35. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/dxm/utils/mark.py +0 -0
  36. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/__init__.py +0 -0
  37. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/constant/__init__.py +0 -0
  38. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/constant/response.py +0 -0
  39. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/main.py +0 -0
  40. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/parser/__init__.py +0 -0
  41. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/parser/order.py +0 -0
  42. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/schemas/__init__.py +0 -0
  43. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/schemas/query/__init__.py +0 -0
  44. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/schemas/query/order.py +0 -0
  45. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/schemas/vo/__init__.py +0 -0
  46. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/four_seller/schemas/vo/order.py +0 -0
  47. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/__init__.py +0 -0
  48. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/schemas/__init__.py +0 -0
  49. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/schemas/query/__init__.py +0 -0
  50. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/schemas/query/order.py +0 -0
  51. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/schemas/query/product.py +0 -0
  52. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/schemas/response/__init__.py +0 -0
  53. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/schemas/response/order.py +0 -0
  54. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/kogan/schemas/response/product.py +0 -0
  55. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/model.py +0 -0
  56. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/py.typed +0 -0
  57. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/takesend/__init__.py +0 -0
  58. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/takesend/config.py +0 -0
  59. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/utils/__init__.py +0 -0
  60. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/utils/close.py +0 -0
  61. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/utils/dxm.py +0 -0
  62. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/utils/float.py +0 -0
  63. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/utils/list_util.py +0 -0
  64. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/src/ey_commerce_lib/utils/str.py +0 -0
  65. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/tests/__init__.py +0 -0
  66. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/tests/dxm/__init__.py +0 -0
  67. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/tests/kogan/__init__.py +0 -0
  68. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/tests/kogan/test_client.py +0 -0
  69. {ey_commerce_lib-1.0.20 → ey_commerce_lib-1.0.22}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ey-commerce-lib
3
- Version: 1.0.20
3
+ Version: 1.0.22
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.20"
3
+ version = "1.0.22"
4
4
  description = "eeyoung电商客户端调用封装"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -9,7 +9,7 @@ from ey_commerce_lib.dxm.constant.order import DxmOrderRuleType
9
9
  from ey_commerce_lib.dxm.parser.common import get_page_info, get_purchase_pagination_info, get_tracking_page_info
10
10
  from ey_commerce_lib.dxm.parser.count import parse_count
11
11
  from ey_commerce_lib.dxm.parser.order import list_order_base_by_html, list_order_rule, get_rule_detail, \
12
- get_order_detail_by_html
12
+ get_order_detail_by_html, parse_comm_search_list_html_get_authid_dict
13
13
  from ey_commerce_lib.dxm.parser.purchase import list_purchasing_all, list_1688_purchase_order_number, \
14
14
  list_wait_pay_page_purchase_order_number
15
15
  from ey_commerce_lib.dxm.parser.tracking import parse_tracking_page
@@ -28,7 +28,7 @@ class DxmClient:
28
28
  self.__cookies = cookies
29
29
  self.__headers = headers
30
30
  self.__sem = asyncio.Semaphore(sem)
31
- timeout = Timeout(connect=5.0, read=20.0, write=10.0, pool=10.0)
31
+ timeout = Timeout(connect=60.0, read=60.0, write=60.0, pool=30.0)
32
32
  self.__base_url = 'https://www.dianxiaomi.com'
33
33
  self.__async_client = AsyncClient(base_url=self.__base_url, cookies=cookies, headers=headers,
34
34
  timeout=timeout)
@@ -847,6 +847,38 @@ class DxmClient:
847
847
  })
848
848
  return order_prior_or_ban_ship_response.json()
849
849
 
850
+ async def reply_msg(self, package_id: str, content: str):
851
+ """
852
+ 回复消息
853
+ """
854
+ data = f'packageId={package_id}&content={content}'
855
+ async with self.__sem:
856
+ reply_msg_response = await self.__async_client.post('/replyMsg/reply.json', content=data)
857
+ return reply_msg_response.json()
858
+
859
+ async def get_authid_like_keyword(self, keyword: str) -> dict:
860
+ """
861
+ 获取店小秘物流方式id,通过关键字模糊查询
862
+ :param keyword: 关键字
863
+ :return:
864
+ """
865
+ async with self.__sem:
866
+ data = {
867
+ 'state': '',
868
+ 'isVoided': '-1',
869
+ 'isOversea': '-1',
870
+ 'commitPlatform': '',
871
+ 'prefixCount': '200',
872
+ 'newVersion': '0',
873
+ 'history': '',
874
+ 'isBatch': '-1',
875
+ 'isFree': '-1',
876
+ }
877
+
878
+ response = await self.__async_client.post('/package/commSearchList.htm', data=data)
879
+ comm_search_list_html = response.text
880
+ return parse_comm_search_list_html_get_authid_dict(comm_search_list_html, keyword)
881
+
850
882
  async def __aenter__(self):
851
883
  return self
852
884
 
@@ -182,6 +182,16 @@ def list_order_base_by_html(html_str: str) -> list[dict]:
182
182
  logistics_info['track_number'] = get_str_list_first_not_blank_or_none(
183
183
  order_first_element.xpath('.//td[6]//span[contains(@class, "limingcentUrlpicson")]/a/text()'))
184
184
  logistics_info['logistics'] = logistics
185
+ # 称重重量
186
+ weight_element_list = order_first_element.xpath('.//td[6]//span[@class="gray-c"]/text()')
187
+ weight = None
188
+ for weight_element in weight_element_list:
189
+ if '称重重量' in weight_element:
190
+ # 如果包含了称重重量的话,获取完整的数字部分
191
+ weight = float(re.search(r'\d+(?:\.\d+)?', weight_element).group())
192
+ # 设置重量部分
193
+ logistics_info['weight'] = weight
194
+
185
195
  # 状态
186
196
  if has_logistics:
187
197
  status = get_str_list_first_not_blank_or_none(order_first_element.xpath('.//td[7]/text()'))
@@ -334,7 +344,8 @@ def get_order_detail_by_html(html_str: str):
334
344
  # 获取可用库存
335
345
  warehouse_available_quantity_element_list = pair_info_element.xpath(
336
346
  './/div[contains(@class, "normalDiv")]/p[2]/span[2]/text()')
337
- warehouse_available_quantity_str = get_str_list_first_not_blank_or_none(warehouse_available_quantity_element_list)
347
+ warehouse_available_quantity_str = get_str_list_first_not_blank_or_none(
348
+ warehouse_available_quantity_element_list)
338
349
  # 获取到可用库存节点
339
350
  if warehouse_available_quantity_str is not None:
340
351
  if warehouse_available_quantity_str.endswith('+'):
@@ -366,3 +377,21 @@ def get_order_detail_by_html(html_str: str):
366
377
  'pair_info_list': pair_info_list,
367
378
  'storage_id': storage_id
368
379
  }
380
+
381
+
382
+ def parse_comm_search_list_html_get_authid_dict(html_str: str, keyword: str):
383
+ """
384
+ 解析网页获取物流方式id字典
385
+ :param html_str:
386
+ :param keyword:
387
+ :return:
388
+ """
389
+ tree = html.fromstring(html_str)
390
+ logistics_authid_dict = {}
391
+ logistics_method_element_list = tree.xpath('//select[@id="advancedAuthSelect"]/option')
392
+ for logistics_method in logistics_method_element_list:
393
+ logistics_authid_text = str(logistics_method.xpath('text()')[0])
394
+ logistics_authid_value = logistics_method.xpath('@value')[0]
395
+ if keyword in logistics_authid_text:
396
+ logistics_authid_dict[logistics_authid_text] = logistics_authid_value
397
+ return logistics_authid_dict
@@ -11,7 +11,7 @@ class KoganClient:
11
11
  def __init__(self, seller_id: str, seller_token: str):
12
12
  self.seller_id = seller_id
13
13
  self.seller_token = seller_token
14
- timeout = Timeout(connect=5.0, read=60.0, write=10.0, pool=10.0)
14
+ timeout = Timeout(connect=60.0, read=60.0, write=60.0, pool=30.0)
15
15
 
16
16
  # 异步客户端
17
17
  self.__async_client = AsyncClient(base_url="https://nimda.kogan.com",
@@ -6,10 +6,12 @@ from ey_commerce_lib.takesend.config import LOGIN_HEADERS, EDIT_HEADERS
6
6
  class TakeSendClient(object):
7
7
 
8
8
  def __init__(self, username: str, password: str):
9
- timeout = Timeout(connect=5.0, read=20.0, write=10.0, pool=10.0)
9
+ timeout = Timeout(connect=60.0, read=60.0, write=60.0, pool=30.0)
10
10
  self.__async_client = AsyncClient(
11
11
  base_url="http://k5.takesend.com:8180",
12
- timeout=timeout)
12
+ timeout=timeout,
13
+ verify=False
14
+ )
13
15
  self.__username = username
14
16
  self.__password = password
15
17
 
@@ -18,9 +20,9 @@ class TakeSendClient(object):
18
20
  自动登录
19
21
  :return:
20
22
  """
21
- # 1. 先访问首页更新JESSIONID
23
+ # 访问首页
22
24
  await self.__async_client.get("/c_index.jsp")
23
- # 2.在登录
25
+ # 登录
24
26
  params = {
25
27
  'action': 'logon'
26
28
  }
@@ -28,9 +30,10 @@ class TakeSendClient(object):
28
30
  'userid': self.__username,
29
31
  'password': self.__password
30
32
  }
31
- await self.__async_client.post("//client/Logon", params=params, data=data, headers=LOGIN_HEADERS)
33
+ # 请求登录接口
34
+ await self.__async_client.post(".//client/Logon", params=params, data=data, headers=LOGIN_HEADERS)
32
35
 
33
- async def __client_cc_order(self, excel_data: list):
36
+ async def client_cc_order(self, excel_data: list | str):
34
37
  """
35
38
  修改泰嘉产品上传重量数据
36
39
  :param excel_data:
@@ -43,7 +46,9 @@ class TakeSendClient(object):
43
46
  data = {
44
47
  'excel[]': excel_data,
45
48
  }
46
- return await self.__async_client.post("/Client/CCOrder", params=params, data=data, headers=EDIT_HEADERS)
49
+
50
+ response = await self.__async_client.post('/Client/CCOrder', params=params, data=data, headers=EDIT_HEADERS)
51
+ return response.json()
47
52
 
48
53
  async def __aenter__(self):
49
54
  return self
@@ -6,6 +6,7 @@ from ey_commerce_lib.dxm.constant.order import ORDER_SEARCH_APPROVAL_BASE_FORM,
6
6
  ORDER_SEARCH_PENDING_PROCESSING_BASE_FORM, ORDER_SEARCH_SELF_WAREHOUSE_BASE_FORM, \
7
7
  ORDER_SEARCH_OUT_OF_STOCK_BASE_FORM, ORDER_SEARCH_HAVE_GOODS_BASE_FORM
8
8
  from ey_commerce_lib.dxm.main import DxmClient
9
+ from ey_commerce_lib.dxm.schemas.order import DxmOrderSearchForm
9
10
  from ey_commerce_lib.dxm.schemas.tracking import TrackingPageListQuery
10
11
  from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProductQuery
11
12
  from ey_commerce_lib.dxm.utils.mark import get_custom_mark_content_list_by_data_custom_mark, \
@@ -50,8 +51,12 @@ async def test_dxm_api():
50
51
  # for pair_info in order.get('detail').get('pair_info_list'):
51
52
  # print(pair_info.get('proid'))
52
53
  # data = await dxm_client.update_dxm_commodity_front_sku('17773195771232287', 'fuck112')
53
- data = await dxm_client.tracking_list(TrackingPageListQuery())
54
- print(len(data))
54
+ # data = await dxm_client.get_authid_like_keyword('泰嘉')
55
+ data = await dxm_client.list_order_base_async(query=DxmOrderSearchForm(
56
+ search_types='trackNum',
57
+ contents='36QT4109377801000931506'
58
+ ))
59
+ print(data)
55
60
 
56
61
 
57
62
  @pytest.mark.asyncio