ey-commerce-lib 1.0.17__tar.gz → 1.0.18__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 (70) hide show
  1. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/PKG-INFO +1 -1
  2. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/pyproject.toml +1 -1
  3. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/main.py +88 -11
  4. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/parser/common.py +17 -0
  5. ey_commerce_lib-1.0.18/src/ey_commerce_lib/dxm/parser/tracking.py +56 -0
  6. ey_commerce_lib-1.0.18/src/ey_commerce_lib/dxm/schemas/tracking.py +45 -0
  7. ey_commerce_lib-1.0.18/tests/dxm/test_purchase.py +66 -0
  8. ey_commerce_lib-1.0.17/tests/dxm/test_purchase.py +0 -91
  9. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/.gitignore +0 -0
  10. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/.python-version +0 -0
  11. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/README.md +0 -0
  12. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/pytest.ini +0 -0
  13. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/__init__.py +0 -0
  14. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/__init__.py +0 -0
  15. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/constant/__init__.py +0 -0
  16. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/constant/order.py +0 -0
  17. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/exception/__init__.py +0 -0
  18. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/exception/common.py +0 -0
  19. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/order.py +0 -0
  20. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/parser/__init__.py +0 -0
  21. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/parser/count.py +0 -0
  22. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/parser/ebay_product.py +0 -0
  23. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/parser/order.py +0 -0
  24. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/parser/purchase.py +0 -0
  25. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/parser/warehouse.py +0 -0
  26. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/schemas/__init__.py +0 -0
  27. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/schemas/common.py +0 -0
  28. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/schemas/dxm_commodity_product.py +0 -0
  29. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/schemas/ebay_product.py +0 -0
  30. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/schemas/order.py +0 -0
  31. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/schemas/warehouse.py +0 -0
  32. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/utils/__init__.py +0 -0
  33. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/utils/dxm_commodity_product.py +0 -0
  34. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/dxm/utils/mark.py +0 -0
  35. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/__init__.py +0 -0
  36. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/constant/__init__.py +0 -0
  37. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/constant/response.py +0 -0
  38. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/main.py +0 -0
  39. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/parser/__init__.py +0 -0
  40. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/parser/order.py +0 -0
  41. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/schemas/__init__.py +0 -0
  42. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/schemas/query/__init__.py +0 -0
  43. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/schemas/query/order.py +0 -0
  44. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/schemas/vo/__init__.py +0 -0
  45. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/four_seller/schemas/vo/order.py +0 -0
  46. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/__init__.py +0 -0
  47. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/main.py +0 -0
  48. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/schemas/__init__.py +0 -0
  49. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/schemas/query/__init__.py +0 -0
  50. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/schemas/query/order.py +0 -0
  51. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/schemas/query/product.py +0 -0
  52. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/schemas/response/__init__.py +0 -0
  53. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/schemas/response/order.py +0 -0
  54. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/kogan/schemas/response/product.py +0 -0
  55. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/model.py +0 -0
  56. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/py.typed +0 -0
  57. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/takesend/__init__.py +0 -0
  58. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/takesend/config.py +0 -0
  59. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/takesend/main.py +0 -0
  60. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/utils/__init__.py +0 -0
  61. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/utils/close.py +0 -0
  62. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/utils/dxm.py +0 -0
  63. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/utils/float.py +0 -0
  64. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/utils/list_util.py +0 -0
  65. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/src/ey_commerce_lib/utils/str.py +0 -0
  66. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/tests/__init__.py +0 -0
  67. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/tests/dxm/__init__.py +0 -0
  68. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/tests/kogan/__init__.py +0 -0
  69. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/tests/kogan/test_client.py +0 -0
  70. {ey_commerce_lib-1.0.17 → ey_commerce_lib-1.0.18}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ey-commerce-lib
3
- Version: 1.0.17
3
+ Version: 1.0.18
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.17"
3
+ version = "1.0.18"
4
4
  description = "eeyoung电商客户端调用封装"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -6,17 +6,19 @@ from httpx import AsyncClient, Timeout
6
6
  from playwright.async_api import async_playwright
7
7
 
8
8
  from ey_commerce_lib.dxm.constant.order import DxmOrderRuleType
9
- from ey_commerce_lib.dxm.parser.common import get_page_info, get_purchase_pagination_info
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
12
  get_order_detail_by_html
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
+ from ey_commerce_lib.dxm.parser.tracking import parse_tracking_page
15
16
  from ey_commerce_lib.dxm.parser.warehouse import list_warehouse_product
16
17
  from ey_commerce_lib.dxm.schemas.common import Page
17
18
  from ey_commerce_lib.dxm.schemas.dxm_commodity_product import ViewDxmCommodityProductResponse
18
19
  from ey_commerce_lib.dxm.schemas.ebay_product import DxmEbayProductModel
19
20
  from ey_commerce_lib.dxm.schemas.order import DxmOrderSearchForm, DxmJsonResponse, DxmCheckProcessResponse, DxmOrderRule
21
+ from ey_commerce_lib.dxm.schemas.tracking import TrackingPageListQuery, TrackingPageListItem
20
22
  from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProduct, WarehouseProductQuery, PurchasingAllQuery
21
23
 
22
24
 
@@ -710,10 +712,12 @@ class DxmClient:
710
712
  try:
711
713
  async with async_playwright() as p:
712
714
  browser = await p.chromium.launch(
713
- headless=False,
715
+ headless=True,
714
716
  args=[
715
717
  '--start-maximized',
716
718
  '--disable-blink-features=AutomationControlled',
719
+ '--no-sandbox',
720
+ '--disable-dev-shm-usage'
717
721
  ]
718
722
  )
719
723
  context = await browser.new_context()
@@ -729,21 +733,94 @@ class DxmClient:
729
733
  ])
730
734
  page = await context.new_page()
731
735
  # 访问
732
- await page.goto(f'{self.__base_url}/dxmCommodityProduct/openEditModal.htm?id={proid}&editOrCopy=0')
736
+ await page.goto(f'{self.__base_url}/dxmCommodityProduct/openEditModal.htm?id={proid}&editOrCopy=0',
737
+ timeout=60000)
733
738
  # 关闭模态框
734
- await page.locator('#theNewestModalLabel > div.modal-dialog > div > div.modal-header > button').click()
739
+ try:
740
+ await page.locator(
741
+ '#theNewestModalLabel > div.modal-dialog > div > div.modal-header > button').click()
742
+ except:
743
+ pass
735
744
  # 输入sku
736
745
  await page.locator('input.variationValue.ui-autocomplete-input').fill(front_sku)
737
746
  # 失去焦点
738
747
  await page.locator('input.variationValue.ui-autocomplete-input').press('Tab')
739
- # 休眠两秒
740
- await asyncio.sleep(2)
741
- # 点击保存
742
- await page.locator('.button.btn-orange.m-left10').first.click()
743
- # 获取保存成功文本
744
- await page.wait_for_selector('.alert-successGreen')
748
+ try:
749
+ # 休眠两秒
750
+ error_text = await page.text_content(selector='div.alert-dangerRed span', timeout=2000)
751
+ return {
752
+ 'code': 500,
753
+ 'msg': error_text
754
+ }
755
+ except Exception as e:
756
+ # 创建监听任务
757
+ async def wait_for_api1():
758
+ async with page.expect_response(
759
+ f"{self.__base_url}/dxmCommodityProduct/editCommodityProduct.json") as response_info:
760
+ pass
761
+ return await response_info.value
762
+
763
+ async def wait_for_api2():
764
+ async with page.expect_response(
765
+ f"{self.__base_url}/dxmCommodityProduct/editCommodityProductGroup.json") as response_info:
766
+ pass
767
+ return await response_info.value
768
+
769
+ # 创建并发任务
770
+ task1 = asyncio.create_task(wait_for_api1())
771
+ task2 = asyncio.create_task(wait_for_api2())
772
+ # 点击保存按钮
773
+ await page.locator('.button.btn-orange.m-left10').first.click()
774
+ # 等待任何一个请求完成
775
+ done, pending = await asyncio.wait(
776
+ [task1, task2],
777
+ return_when=asyncio.FIRST_COMPLETED
778
+ )
779
+ # 取消其他未完成的任务
780
+ for task in pending:
781
+ task.cancel()
782
+ # 获取完成的请求结果
783
+ completed_task = list(done)[0]
784
+ response = await completed_task
785
+ return await response.json()
745
786
  except Exception as e:
746
- raise Exception(f'更新店小秘 仓库-商品详情中的平台sku失败-失败原因:{traceback.format_exc()}')
787
+ return {
788
+ 'code': 500,
789
+ 'msg': traceback.format_exc()
790
+ }
791
+
792
+ async def tracking_page_list(self, query: TrackingPageListQuery) -> Page[TrackingPageListItem]:
793
+ """
794
+ 分页查询物流追踪页表
795
+ :param query:
796
+ :return:
797
+ """
798
+ async with self.__sem:
799
+ tracking_page_list_response = await self.__async_client.post('/tracking/pageList.htm',
800
+ data=query.model_dump(by_alias=True))
801
+ tracking_page_list_html = tracking_page_list_response.text
802
+ page = get_tracking_page_info(tracking_page_list_html)
803
+ page.records = parse_tracking_page(tracking_page_list_html)
804
+ return page
805
+
806
+ async def tracking_list(self, query: TrackingPageListQuery) -> list[TrackingPageListItem]:
807
+ async with self.__sem:
808
+ query.page_no = '1'
809
+ tracking_page_list_response = await self.__async_client.post('/tracking/pageList.htm',
810
+ data=query.model_dump(by_alias=True))
811
+ tracking_page_list_html = tracking_page_list_response.text
812
+ # 获取分页数据
813
+ page = get_tracking_page_info(tracking_page_list_html)
814
+ # 获取总页数
815
+ total_page = page.total_page
816
+ # 最终记录
817
+ result = parse_tracking_page(tracking_page_list_html)
818
+ for page_num in range(2, total_page + 1):
819
+ query.page_no = str(page_num)
820
+ # 获取分页数据
821
+ page_data = await self.tracking_page_list(query)
822
+ result.extend(page_data.records)
823
+ return result
747
824
 
748
825
  async def __aenter__(self):
749
826
  return self
@@ -4,6 +4,7 @@ from typing import TypedDict
4
4
  from lxml import html
5
5
 
6
6
  from ey_commerce_lib.dxm.exception.common import PageInfoNotFoundException
7
+ from ey_commerce_lib.model import Page
7
8
 
8
9
 
9
10
  class PageInfo(TypedDict):
@@ -92,3 +93,19 @@ def get_purchasing_page_info(html_str: str):
92
93
  'total_size': total_size,
93
94
  'page_number': page_number
94
95
  }
96
+
97
+
98
+ def get_tracking_page_info(html_str: str):
99
+ tree = html.fromstring(html_str)
100
+ total = int(tree.xpath('//input[@id="totalSizeOrder"]/@value')[0])
101
+ page_size = int(tree.xpath('//input[@id="pageSizeOrder"]/@value')[0])
102
+ page_number = int(tree.xpath('//input[@id="pageNoOrder"]/@value')[0])
103
+ total_page = int(tree.xpath('//input[@id="totalPageOrder"]/@value')[0])
104
+ return Page(
105
+ total=total,
106
+ page_size=page_size,
107
+ page_number=page_number,
108
+ total_page=total_page,
109
+ records=[]
110
+ )
111
+
@@ -0,0 +1,56 @@
1
+ from lxml import html
2
+
3
+ from ey_commerce_lib.dxm.schemas.tracking import TrackingPageListItem
4
+ from ey_commerce_lib.utils.list_util import get_str_list_first_not_blank_or_none
5
+
6
+
7
+ def parse_tracking_page(html_content: str):
8
+ tree = html.fromstring(html_content)
9
+ # 物流追踪节点列表
10
+ tracking_element_list = tree.xpath('//tbody[@id="dhSysMsg"]/tr[@class="content"]')
11
+ tracking_list = []
12
+ for tracking_element in tracking_element_list:
13
+ # 获取包裹号
14
+ package_number = tracking_element.xpath('@data-tracknum')[0].strip()
15
+ # 获取订单id
16
+ order_id = tracking_element.xpath('@data-orderid')[0].strip()
17
+ # 获取收件人姓名
18
+ receiver_name = tracking_element.xpath('./td[3]/text()')[0].strip()
19
+ # 获取国家
20
+ country = get_str_list_first_not_blank_or_none(tracking_element.xpath('./td[3]/span/text()'))
21
+ # 获取物流方式
22
+ logistics_method = tracking_element.xpath('./td[4]/text()')[0].strip()
23
+ # 物流状态
24
+ logistics_status = tracking_element.xpath('./td[4]/span/@title')[0].replace('「', '').replace('」', '')
25
+ # 物流单号
26
+ logistics_number = tracking_element.xpath('./td[4]//span[@class="limingcentUrlpic"]/text()')[0].strip()
27
+ # carrierCode
28
+ carrier_code = get_str_list_first_not_blank_or_none(tracking_element.xpath('./td[5]/a/@data-carriercode'))
29
+ # 最新消息
30
+ latest_message = get_str_list_first_not_blank_or_none(tracking_element.xpath('./td[5]/text()'))
31
+ # 运输信息
32
+ transport_info = tracking_element.xpath('./td[6]/text()')[0].strip()
33
+ # 平台和店铺
34
+ platform, shop = tracking_element.xpath('./td[7]')[0].text_content().split(':')
35
+ time_list = []
36
+ # 获取时间
37
+ for time in tracking_element.xpath('./td[8]')[0].text_content().strip().split('\n'):
38
+ time_list.append(time.strip())
39
+ platform = platform.strip()
40
+ shop = shop.strip()
41
+ tracking_list.append(TrackingPageListItem(
42
+ package_number=package_number,
43
+ order_id=order_id,
44
+ receiver_name=receiver_name,
45
+ country=country,
46
+ logistics_method=logistics_method,
47
+ logistics_status=logistics_status,
48
+ logistics_number=logistics_number,
49
+ latest_message=latest_message,
50
+ transport_info=transport_info,
51
+ platform=platform,
52
+ shop=shop,
53
+ time_list=time_list,
54
+ carrier_code=carrier_code
55
+ ))
56
+ return tracking_list
@@ -0,0 +1,45 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, Field, ConfigDict
4
+
5
+
6
+ class TrackingPageListQuery(BaseModel):
7
+ page_no: str = Field('1', alias='pageNo', description='页码')
8
+ state_type: str = Field('all', alias='stateType', description='状态类型,默认 all(全部)')
9
+ platform: str = Field('', alias='platform', description='平台渠道')
10
+ shop_id: str = Field('-1', alias="shopId", description='店铺 ID')
11
+ country: str = Field('', alias="country", description="国家")
12
+ auth_id: str = Field('-1', alias="authId", description="物流方式")
13
+ ship_start_time: str = Field('', alias="shipStartTime", description="发货开始时间")
14
+ ship_end_time: str = Field('', alias="shipEndTime", description="发货结束时间")
15
+ track_start_time: str = Field('-1', alias='trackStartTime', description='运输天数')
16
+ track_end_time: str = Field('-1', alias='trackEndTime', description='运输天数')
17
+ is_comm: str = Field('', alias='isComm', description='备注')
18
+ order_field: str = Field('shipped_time', alias='orderField', description='排序方式')
19
+ is_desc: str = Field('1', alias='isDesc', description='排序方式')
20
+ search_type: str = Field('orderId', alias='searchType', description='搜索类型 orderId(订单id)')
21
+ search_value: str = Field('', alias="searchValue", description="搜索关键字")
22
+ is_del: str = Field('0', alias="isDel", description="是否删除,0 否 1 是")
23
+ history: str = Field('', alias="history", description="历史记录标志")
24
+ is_stop: str = Field('0', alias='isStop', description='是否暂停,0 正常追踪 1 暂停追踪')
25
+ no_update_days: str = Field('0', alias="noUpdateDays", description="异常类型 无更新天数")
26
+
27
+ model_config = ConfigDict(populate_by_name=True)
28
+
29
+
30
+ class TrackingPageListItem(BaseModel):
31
+ package_number: str = Field(..., alias='packageNumber', description='包裹号')
32
+ order_id: str = Field(..., alias='orderId', description='订单号')
33
+ receiver_name: str = Field(..., alias='receiverName', description='收件人姓名')
34
+ country: Optional[str] = Field(..., alias='country', description='国家')
35
+ logistics_method: str = Field(..., alias='logisticsMethod', description='物流方式')
36
+ logistics_status: str = Field(..., alias='logisticsStatus', description='物流状态')
37
+ logistics_number: str = Field(..., alias='logisticsNumber', description='物流单号')
38
+ carrier_code: Optional[str] = Field(..., alias='carrierCode', description='物流公司编码')
39
+ latest_message: Optional[str] = Field(..., alias='latestMessage', description='最新物流信息')
40
+ transport_info: str = Field(..., alias='transportInfo', description='运输信息')
41
+ platform: str = Field(..., alias='platform', description='平台渠道')
42
+ shop: str = Field(..., alias='shop', description='店铺')
43
+ time_list: list[str] = Field([], alias='timeList', description='时间列表')
44
+
45
+ model_config = ConfigDict(populate_by_name=True)
@@ -0,0 +1,66 @@
1
+ import json
2
+
3
+ import pytest
4
+
5
+ from ey_commerce_lib.dxm.constant.order import ORDER_SEARCH_APPROVAL_BASE_FORM, \
6
+ ORDER_SEARCH_PENDING_PROCESSING_BASE_FORM, ORDER_SEARCH_SELF_WAREHOUSE_BASE_FORM, \
7
+ ORDER_SEARCH_OUT_OF_STOCK_BASE_FORM, ORDER_SEARCH_HAVE_GOODS_BASE_FORM
8
+ from ey_commerce_lib.dxm.main import DxmClient
9
+ from ey_commerce_lib.dxm.schemas.tracking import TrackingPageListQuery
10
+ from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProductQuery
11
+ from ey_commerce_lib.dxm.utils.mark import get_custom_mark_content_list_by_data_custom_mark, \
12
+ generate_add_or_update_user_comment_data_by_content_list
13
+ from ey_commerce_lib.four_seller.main import FourSellerClient
14
+ from ey_commerce_lib.four_seller.schemas.query.order import FourSellerOrderQueryModel
15
+ from ey_commerce_lib.takesend.main import TakeSendClient
16
+ import ey_commerce_lib.dxm.utils.dxm_commodity_product as dxm_commodity_product_util
17
+
18
+
19
+ async def login_success(user_token: str):
20
+ print(f'user_token: {user_token}')
21
+ pass
22
+
23
+
24
+ @pytest.mark.asyncio
25
+ async def test_auto_login_4seller():
26
+ # user_token = await auto_login_4seller(user_name="sky@eeyoung.com", password="ey010203@@")
27
+ # print(user_token)
28
+ async with FourSellerClient(
29
+ user_name="xxxxx",
30
+ password="xxxxxx",
31
+ login_success_call_back=login_success,
32
+ user_token="xxxxxx") as four_seller_client:
33
+ await four_seller_client.list_history_order(FourSellerOrderQueryModel())
34
+
35
+
36
+ cookies = {
37
+
38
+ }
39
+
40
+ headers = {
41
+
42
+ }
43
+
44
+
45
+ @pytest.mark.asyncio
46
+ async def test_dxm_api():
47
+ async with (DxmClient(headers=headers, cookies=cookies) as dxm_client):
48
+ # data = await dxm_client.list_order_detail_async(query=ORDER_SEARCH_HAVE_GOODS_BASE_FORM)
49
+ # for order in data:
50
+ # for pair_info in order.get('detail').get('pair_info_list'):
51
+ # print(pair_info.get('proid'))
52
+ # data = await dxm_client.update_dxm_commodity_front_sku('17773195771232287', 'fuck112')
53
+ data = await dxm_client.tracking_list(TrackingPageListQuery())
54
+ print(len(data))
55
+
56
+
57
+ @pytest.mark.asyncio
58
+ async def test_warehouse():
59
+ async with (DxmClient(headers=headers, cookies=cookies) as dxm_client):
60
+ print(await dxm_client.page_warehouse_product(WarehouseProductQuery()))
61
+
62
+
63
+ @pytest.mark.asyncio
64
+ async def test_tasksend_api():
65
+ async with (TakeSendClient(username="", password="") as tasksend_client):
66
+ await tasksend_client.login()
@@ -1,91 +0,0 @@
1
- import json
2
-
3
- import pytest
4
-
5
- from ey_commerce_lib.dxm.constant.order import ORDER_SEARCH_APPROVAL_BASE_FORM, \
6
- ORDER_SEARCH_PENDING_PROCESSING_BASE_FORM, ORDER_SEARCH_SELF_WAREHOUSE_BASE_FORM, \
7
- ORDER_SEARCH_OUT_OF_STOCK_BASE_FORM, ORDER_SEARCH_HAVE_GOODS_BASE_FORM
8
- from ey_commerce_lib.dxm.main import DxmClient
9
- from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProductQuery
10
- from ey_commerce_lib.dxm.utils.mark import get_custom_mark_content_list_by_data_custom_mark, \
11
- generate_add_or_update_user_comment_data_by_content_list
12
- from ey_commerce_lib.four_seller.main import FourSellerClient
13
- from ey_commerce_lib.four_seller.schemas.query.order import FourSellerOrderQueryModel
14
- from ey_commerce_lib.takesend.main import TakeSendClient
15
- import ey_commerce_lib.dxm.utils.dxm_commodity_product as dxm_commodity_product_util
16
-
17
-
18
- async def login_success(user_token: str):
19
- print(f'user_token: {user_token}')
20
- pass
21
-
22
-
23
- @pytest.mark.asyncio
24
- async def test_auto_login_4seller():
25
- # user_token = await auto_login_4seller(user_name="sky@eeyoung.com", password="ey010203@@")
26
- # print(user_token)
27
- async with FourSellerClient(
28
- user_name="xxxxx",
29
- password="xxxxxx",
30
- login_success_call_back=login_success,
31
- user_token="xxxxxx") as four_seller_client:
32
- await four_seller_client.list_history_order(FourSellerOrderQueryModel())
33
-
34
-
35
- cookies = {
36
- 'dxm_i': 'MTAyNzg5NiFhVDB4TURJM09EazIhZjc5ZTMxMjZmN2Q3NTk5OGZlMDg4YjQzNzNlNzlmOWY',
37
- 'dxm_t': 'MTcxNDk2NDU4MiFkRDB4TnpFME9UWTBOVGd5IWIzZWRjYTc3YTdjYWE0MmIxMWYwNjFhOTlmMDgxZjY5',
38
- 'dxm_c': 'TWVOMVpiclYhWXoxTlpVNHhXbUp5VmchNmM5MmM5ODc1MDBkODVjOWJmOTFlMzdhNGJiNWI3Njk',
39
- 'dxm_w': 'ZDc3NWVhOTdkOTEyNGE4ZmRkODBmYzc2YmFlOGVjZjEhZHoxa056YzFaV0U1TjJRNU1USTBZVGhtWkdRNE1HWmpOelppWVdVNFpXTm1NUSFmZWZiZGZiMTEwMzhlN2M4M2MzYjZmYjAxYTcxMjViMw',
40
- 'dxm_s': 'aMHO7LWKAQe6NzFrV3O4cceXkBriLGNmwondOR7INWs',
41
- 'MYJ_MKTG_fapsc5t4tc': 'JTdCJTdE',
42
- 'MYJ_fapsc5t4tc': 'JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjJkMGRlYzNkYi00MTNlLTQyZjktOWIxNC0xYzBhZTY4MTk4ZmIlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxMDI3ODk2JTIyJTJDJTIycGFyZW50SWQlMjIlM0ElMjIyNTg2MzQlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzMxMDU5MDc1MjU0JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTczMTA1OTA3NTQyNCUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTE2JTdE',
43
- 'MYJ_fapsc5t4tc': 'JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjJkMGRlYzNkYi00MTNlLTQyZjktOWIxNC0xYzBhZTY4MTk4ZmIlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxMDI3ODk2JTIyJTJDJTIycGFyZW50SWQlMjIlM0ElMjIyNTg2MzQlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzMxMDU5MDc1MTEwJTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTczMTA1OTA3NTk5NiUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTE2JTdE',
44
- '_dxm_ad_client_id': '7AEFA0B78CE1B35075D391C5226612CED',
45
- 'Hm_lvt_f8001a3f3d9bf5923f780580eb550c0b': '1731459796,1731547149,1731590878,1731893161',
46
- 'HMACCOUNT': 'F266E8F609D8D8B1',
47
- 'MYJ_fapsc5t4tc': 'JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjJkMGRlYzNkYi00MTNlLTQyZjktOWIxNC0xYzBhZTY4MTk4ZmIlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxMDI3ODk2JTIyJTJDJTIycGFyZW50SWQlMjIlM0ElMjIyNTg2MzQlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzMxOTAxNDMzMTk3JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRJZCUyMiUzQTExNiU3RA==',
48
- 'Hm_lpvt_f8001a3f3d9bf5923f780580eb550c0b': '1731901433',
49
- 'JSESSIONID': 'CD9C8372185D453012E5EEFBA64E2C9C',
50
- }
51
-
52
- headers = {
53
- 'accept': 'text/html, */*; q=0.01',
54
- 'accept-language': 'zh-CN,zh;q=0.9',
55
- 'cache-control': 'no-cache',
56
- 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
57
- 'origin': 'https://www.dianxiaomi.com',
58
- 'pragma': 'no-cache',
59
- 'priority': 'u=1, i',
60
- 'referer': 'https://www.dianxiaomi.com/sys/index.htm?go=m420',
61
- 'sec-ch-ua': '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
62
- 'sec-ch-ua-mobile': '?0',
63
- 'sec-ch-ua-platform': '"Windows"',
64
- 'sec-fetch-dest': 'empty',
65
- 'sec-fetch-mode': 'cors',
66
- 'sec-fetch-site': 'same-origin',
67
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
68
- 'x-requested-with': 'XMLHttpRequest',
69
- }
70
-
71
-
72
- @pytest.mark.asyncio
73
- async def test_dxm_api():
74
- async with (DxmClient(headers=headers, cookies=cookies) as dxm_client):
75
- # data = await dxm_client.list_order_detail_async(query=ORDER_SEARCH_HAVE_GOODS_BASE_FORM)
76
- # for order in data:
77
- # for pair_info in order.get('detail').get('pair_info_list'):
78
- # print(pair_info.get('proid'))
79
- data = await dxm_client.update_dxm_commodity_front_sku('17773195771232287', 'fuck112')
80
-
81
-
82
- @pytest.mark.asyncio
83
- async def test_warehouse():
84
- async with (DxmClient(headers=headers, cookies=cookies) as dxm_client):
85
- print(await dxm_client.page_warehouse_product(WarehouseProductQuery()))
86
-
87
-
88
- @pytest.mark.asyncio
89
- async def test_tasksend_api():
90
- async with (TakeSendClient(username="", password="") as tasksend_client):
91
- await tasksend_client.login()