ey-commerce-lib 1.0.22__tar.gz → 1.0.24__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.
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/PKG-INFO +1 -1
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/pyproject.toml +1 -1
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/main.py +49 -1
- ey_commerce_lib-1.0.24/src/ey_commerce_lib/dxm/parser/export_template.py +17 -0
- ey_commerce_lib-1.0.24/src/ey_commerce_lib/dxm/schemas/export_package.py +23 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/main.py +3 -2
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/takesend/config.py +14 -1
- ey_commerce_lib-1.0.24/src/ey_commerce_lib/takesend/main.py +117 -0
- ey_commerce_lib-1.0.24/src/ey_commerce_lib/takesend/parser/order.py +20 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/tests/dxm/test_purchase.py +26 -12
- ey_commerce_lib-1.0.24/tests/kogan/__init__.py +0 -0
- ey_commerce_lib-1.0.22/src/ey_commerce_lib/dxm/order.py +0 -2
- ey_commerce_lib-1.0.22/src/ey_commerce_lib/takesend/main.py +0 -57
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/.gitignore +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/.python-version +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/README.md +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/pytest.ini +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/constant/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/constant/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/exception/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/exception/common.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/common.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/count.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/ebay_product.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/purchase.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/tracking.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/warehouse.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/common.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/dxm_commodity_product.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/ebay_product.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/tracking.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/warehouse.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/utils/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/utils/dxm_commodity_product.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/utils/mark.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/constant/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/constant/response.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/parser/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/parser/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/schemas/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/schemas/query/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/schemas/query/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/schemas/vo/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/schemas/vo/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/main.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/query/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/query/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/query/product.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/response/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/response/order.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/response/product.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/model.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/py.typed +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/takesend/__init__.py +0 -0
- {ey_commerce_lib-1.0.22/src/ey_commerce_lib/utils → ey_commerce_lib-1.0.24/src/ey_commerce_lib/takesend/parser}/__init__.py +0 -0
- {ey_commerce_lib-1.0.22/tests → ey_commerce_lib-1.0.24/src/ey_commerce_lib/utils}/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/utils/close.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/utils/dxm.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/utils/float.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/utils/list_util.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/utils/str.py +0 -0
- {ey_commerce_lib-1.0.22/tests/dxm → ey_commerce_lib-1.0.24/tests}/__init__.py +0 -0
- {ey_commerce_lib-1.0.22/tests/kogan → ey_commerce_lib-1.0.24/tests/dxm}/__init__.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/tests/kogan/test_client.py +0 -0
- {ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/uv.lock +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import time
|
|
3
2
|
import traceback
|
|
4
3
|
|
|
5
4
|
from httpx import AsyncClient, Timeout
|
|
@@ -8,6 +7,7 @@ from playwright.async_api import async_playwright
|
|
|
8
7
|
from ey_commerce_lib.dxm.constant.order import DxmOrderRuleType
|
|
9
8
|
from ey_commerce_lib.dxm.parser.common import get_page_info, get_purchase_pagination_info, get_tracking_page_info
|
|
10
9
|
from ey_commerce_lib.dxm.parser.count import parse_count
|
|
10
|
+
from ey_commerce_lib.dxm.parser.export_template import parse_list_export_template
|
|
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, 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, \
|
|
@@ -17,6 +17,7 @@ from ey_commerce_lib.dxm.parser.warehouse import list_warehouse_product
|
|
|
17
17
|
from ey_commerce_lib.dxm.schemas.common import Page
|
|
18
18
|
from ey_commerce_lib.dxm.schemas.dxm_commodity_product import ViewDxmCommodityProductResponse
|
|
19
19
|
from ey_commerce_lib.dxm.schemas.ebay_product import DxmEbayProductModel
|
|
20
|
+
from ey_commerce_lib.dxm.schemas.export_package import ExportPackageOrderModel
|
|
20
21
|
from ey_commerce_lib.dxm.schemas.order import DxmOrderSearchForm, DxmJsonResponse, DxmCheckProcessResponse, DxmOrderRule
|
|
21
22
|
from ey_commerce_lib.dxm.schemas.tracking import TrackingPageListQuery, TrackingPageListItem
|
|
22
23
|
from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProduct, WarehouseProductQuery, PurchasingAllQuery
|
|
@@ -879,6 +880,53 @@ class DxmClient:
|
|
|
879
880
|
comm_search_list_html = response.text
|
|
880
881
|
return parse_comm_search_list_html_get_authid_dict(comm_search_list_html, keyword)
|
|
881
882
|
|
|
883
|
+
async def export_template_get_by_id_json(self, id_str: str):
|
|
884
|
+
"""
|
|
885
|
+
根据id获取导出模板配置
|
|
886
|
+
:param id_str: 模板id
|
|
887
|
+
:return:
|
|
888
|
+
"""
|
|
889
|
+
async with self.__sem:
|
|
890
|
+
response = await self.__async_client.post('/exportTemplate/getById.json', data={
|
|
891
|
+
'id': id_str
|
|
892
|
+
})
|
|
893
|
+
return response.json()
|
|
894
|
+
|
|
895
|
+
async def list_export_template(self):
|
|
896
|
+
"""
|
|
897
|
+
获取导出模板的列表
|
|
898
|
+
:return:
|
|
899
|
+
"""
|
|
900
|
+
async with self.__sem:
|
|
901
|
+
response = await self.__async_client.post('/exportTemplate/index.htm')
|
|
902
|
+
return parse_list_export_template(response.text)
|
|
903
|
+
|
|
904
|
+
async def export_package_order(self, data: ExportPackageOrderModel):
|
|
905
|
+
"""
|
|
906
|
+
导出包裹订单
|
|
907
|
+
:param data: 导出参数模型类
|
|
908
|
+
:return:
|
|
909
|
+
"""
|
|
910
|
+
async with self.__sem:
|
|
911
|
+
response = await self.__async_client.post('order/exportPackageOrder.json',
|
|
912
|
+
data=data.model_dump(by_alias=True))
|
|
913
|
+
uuid = response.json().get('uuid')
|
|
914
|
+
if not uuid:
|
|
915
|
+
raise Exception('导出失败')
|
|
916
|
+
code = 0
|
|
917
|
+
msg = ''
|
|
918
|
+
# 如果导出状态没有完成就一直循环
|
|
919
|
+
while code == 0:
|
|
920
|
+
check_process_res = await self.__check_process(uuid)
|
|
921
|
+
code = check_process_res.get('processMsg').get('code')
|
|
922
|
+
msg = check_process_res.get('processMsg').get('msg')
|
|
923
|
+
print(f'导出中,{check_process_res}')
|
|
924
|
+
await asyncio.sleep(5)
|
|
925
|
+
# code为1代表导出成功
|
|
926
|
+
if code != 1:
|
|
927
|
+
raise Exception(f'导出失败,失败原因:{msg}')
|
|
928
|
+
return msg
|
|
929
|
+
|
|
882
930
|
async def __aenter__(self):
|
|
883
931
|
return self
|
|
884
932
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from lxml import html
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def parse_list_export_template(html_content: str):
|
|
5
|
+
tree = html.fromstring(html_content)
|
|
6
|
+
export_template_element_list = tree.xpath('//div[@class="page-list no-page"]/table[@class="in-table"]/tbody/tr')
|
|
7
|
+
export_template_list = []
|
|
8
|
+
for export_template_element in export_template_element_list:
|
|
9
|
+
template_id = export_template_element.xpath('@id')[0].replace('tr', '')
|
|
10
|
+
template_name = export_template_element.xpath('./td[1]/text()')[0].strip()
|
|
11
|
+
field_str = export_template_element.xpath('./td[2]/text()')[0].strip()
|
|
12
|
+
export_template_list.append({
|
|
13
|
+
'template_id': template_id,
|
|
14
|
+
'template_name': template_name,
|
|
15
|
+
'field_str': field_str
|
|
16
|
+
})
|
|
17
|
+
return export_template_list
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field, ConfigDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ExportPackageOrderModel(BaseModel):
|
|
7
|
+
template_id: str = Field(alias="templateId", description="模板ID")
|
|
8
|
+
package_ids: str = Field("", alias="packageIds", description="packageId使用,号连接")
|
|
9
|
+
export_keys: str = Field(alias="exportKeys", description="导出字段, 需要使用urllib.parse.quote编码")
|
|
10
|
+
order_field: str = Field('order_create_time', alias="orderField", description="固定值不用管")
|
|
11
|
+
state: str = Field("", alias="state", description="订单状态")
|
|
12
|
+
start_time: str = Field("", alias="startTime", description="开始时间")
|
|
13
|
+
end_time: str = Field("", alias="endTime", description="结束时间")
|
|
14
|
+
time_type: str = Field("", alias="timeType", description="时间类型 2(发货时间) 0(付款时间) 1(下单时间)")
|
|
15
|
+
export_style: str = Field("1", alias="exportStyle", description="按包裹导出(1) 按订单导出(0) 按产品导出(2)")
|
|
16
|
+
history: str = Field("", alias="history", description="120天订单('') 历史订单('all')")
|
|
17
|
+
is_voided: str = Field("-1", alias="isVoided")
|
|
18
|
+
rule_id: str = Field("-1", alias="ruleId")
|
|
19
|
+
sysrule: str = Field("", alias="sysrule")
|
|
20
|
+
request_location: str = Field('0', alias="requestLocation", description="页面上pageTag的值(一般不用管0)")
|
|
21
|
+
is_search: str = Field('1', alias="isSearch")
|
|
22
|
+
|
|
23
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
@@ -4,7 +4,7 @@ import logging
|
|
|
4
4
|
from typing import Callable
|
|
5
5
|
|
|
6
6
|
import ddddocr
|
|
7
|
-
from httpx import AsyncClient, ReadTimeout
|
|
7
|
+
from httpx import AsyncClient, ReadTimeout, Timeout
|
|
8
8
|
from playwright.async_api import async_playwright, TimeoutError
|
|
9
9
|
|
|
10
10
|
from ey_commerce_lib.four_seller.constant.response import ResponseCodeEnum
|
|
@@ -37,13 +37,14 @@ class FourSellerClient:
|
|
|
37
37
|
self.__login_in_progress = None
|
|
38
38
|
# ddddocr实例
|
|
39
39
|
self.__ocr = ddddocr.DdddOcr()
|
|
40
|
+
timeout = Timeout(connect=60.0, read=60.0, write=60.0, pool=30.0)
|
|
40
41
|
# 异步客户端
|
|
41
42
|
self.__async_client = AsyncClient(base_url="https://www.4seller.com", cookies={"userToken": user_token},
|
|
42
43
|
headers={
|
|
43
44
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
44
45
|
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 "
|
|
45
46
|
"Safari/537.36"
|
|
46
|
-
})
|
|
47
|
+
}, timeout=timeout)
|
|
47
48
|
|
|
48
49
|
async def __auto_login_4seller(self) -> str:
|
|
49
50
|
"""
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
from httpx import AsyncClient, Timeout
|
|
2
|
+
|
|
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
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TakeSendClient(object):
|
|
8
|
+
|
|
9
|
+
def __init__(self, username: str, password: str):
|
|
10
|
+
timeout = Timeout(connect=60.0, read=60.0, write=60.0, pool=30.0)
|
|
11
|
+
self.__async_client = AsyncClient(
|
|
12
|
+
base_url="http://k5.takesend.com:8180",
|
|
13
|
+
timeout=timeout,
|
|
14
|
+
verify=False
|
|
15
|
+
)
|
|
16
|
+
self.__username = username
|
|
17
|
+
self.__password = password
|
|
18
|
+
|
|
19
|
+
async def login(self):
|
|
20
|
+
"""
|
|
21
|
+
自动登录
|
|
22
|
+
:return:
|
|
23
|
+
"""
|
|
24
|
+
# 访问首页
|
|
25
|
+
await self.__async_client.get("/c_index.jsp")
|
|
26
|
+
# 登录
|
|
27
|
+
params = {
|
|
28
|
+
'action': 'logon'
|
|
29
|
+
}
|
|
30
|
+
data = {
|
|
31
|
+
'userid': self.__username,
|
|
32
|
+
'password': self.__password
|
|
33
|
+
}
|
|
34
|
+
# 请求登录接口
|
|
35
|
+
await self.__async_client.post(".//client/Logon", params=params, data=data, headers=LOGIN_HEADERS)
|
|
36
|
+
|
|
37
|
+
async def client_cc_order(self, excel_data: list | str):
|
|
38
|
+
"""
|
|
39
|
+
修改泰嘉产品上传重量数据
|
|
40
|
+
:param excel_data:
|
|
41
|
+
:return:
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
params = {
|
|
45
|
+
'action': 'updateDweight',
|
|
46
|
+
}
|
|
47
|
+
data = {
|
|
48
|
+
'excel[]': excel_data,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
response = await self.__async_client.post('/Client/CCOrder', params=params, data=data, headers=EDIT_HEADERS)
|
|
52
|
+
return response.json()
|
|
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
|
+
|
|
113
|
+
async def __aenter__(self):
|
|
114
|
+
return self
|
|
115
|
+
|
|
116
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
117
|
+
await self.__async_client.aclose()
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import urllib.parse
|
|
2
3
|
|
|
3
4
|
import pytest
|
|
4
5
|
|
|
@@ -6,6 +7,7 @@ from ey_commerce_lib.dxm.constant.order import ORDER_SEARCH_APPROVAL_BASE_FORM,
|
|
|
6
7
|
ORDER_SEARCH_PENDING_PROCESSING_BASE_FORM, ORDER_SEARCH_SELF_WAREHOUSE_BASE_FORM, \
|
|
7
8
|
ORDER_SEARCH_OUT_OF_STOCK_BASE_FORM, ORDER_SEARCH_HAVE_GOODS_BASE_FORM
|
|
8
9
|
from ey_commerce_lib.dxm.main import DxmClient
|
|
10
|
+
from ey_commerce_lib.dxm.schemas.export_package import ExportPackageOrderModel
|
|
9
11
|
from ey_commerce_lib.dxm.schemas.order import DxmOrderSearchForm
|
|
10
12
|
from ey_commerce_lib.dxm.schemas.tracking import TrackingPageListQuery
|
|
11
13
|
from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProductQuery
|
|
@@ -15,6 +17,7 @@ from ey_commerce_lib.four_seller.main import FourSellerClient
|
|
|
15
17
|
from ey_commerce_lib.four_seller.schemas.query.order import FourSellerOrderQueryModel
|
|
16
18
|
from ey_commerce_lib.takesend.main import TakeSendClient
|
|
17
19
|
import ey_commerce_lib.dxm.utils.dxm_commodity_product as dxm_commodity_product_util
|
|
20
|
+
from ey_commerce_lib.takesend.parser.order import get_order_track_number_list
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
async def login_success(user_token: str):
|
|
@@ -24,14 +27,9 @@ async def login_success(user_token: str):
|
|
|
24
27
|
|
|
25
28
|
@pytest.mark.asyncio
|
|
26
29
|
async def test_auto_login_4seller():
|
|
27
|
-
# user_token = await auto_login_4seller(user_name="sky@eeyoung.com", password="ey010203@@")
|
|
28
30
|
# print(user_token)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
password="xxxxxx",
|
|
32
|
-
login_success_call_back=login_success,
|
|
33
|
-
user_token="xxxxxx") as four_seller_client:
|
|
34
|
-
await four_seller_client.list_history_order(FourSellerOrderQueryModel())
|
|
31
|
+
pass
|
|
32
|
+
|
|
35
33
|
|
|
36
34
|
|
|
37
35
|
cookies = {
|
|
@@ -52,11 +50,27 @@ async def test_dxm_api():
|
|
|
52
50
|
# print(pair_info.get('proid'))
|
|
53
51
|
# data = await dxm_client.update_dxm_commodity_front_sku('17773195771232287', 'fuck112')
|
|
54
52
|
# data = await dxm_client.get_authid_like_keyword('泰嘉')
|
|
55
|
-
data = await dxm_client.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
data = await dxm_client.list_export_template()
|
|
54
|
+
for item in data:
|
|
55
|
+
if item.get('template_name') == '周报订单导出模板':
|
|
56
|
+
template_json = await dxm_client.export_template_get_by_id_json(id_str=item.get('template_id'))
|
|
57
|
+
template_id = template_json.get('template').get('id')
|
|
58
|
+
template_field = template_json.get('template').get('templateField')
|
|
59
|
+
url = await dxm_client.export_package_order(ExportPackageOrderModel(
|
|
60
|
+
# 模板id
|
|
61
|
+
template_id=f'{template_id}',
|
|
62
|
+
# 导出字段
|
|
63
|
+
export_keys=urllib.parse.quote(template_field),
|
|
64
|
+
# 按包裹导出
|
|
65
|
+
export_type='1',
|
|
66
|
+
# 发货时间
|
|
67
|
+
time_type='2',
|
|
68
|
+
# 已发货
|
|
69
|
+
state='shipped',
|
|
70
|
+
start_time='2025-08-06 00:00:00',
|
|
71
|
+
end_time='2025-08-12 23:59:59'
|
|
72
|
+
))
|
|
73
|
+
print(f'导出成功,url={url}')
|
|
60
74
|
|
|
61
75
|
|
|
62
76
|
@pytest.mark.asyncio
|
|
File without changes
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
from httpx import AsyncClient, Timeout
|
|
2
|
-
|
|
3
|
-
from ey_commerce_lib.takesend.config import LOGIN_HEADERS, EDIT_HEADERS
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TakeSendClient(object):
|
|
7
|
-
|
|
8
|
-
def __init__(self, username: str, password: str):
|
|
9
|
-
timeout = Timeout(connect=60.0, read=60.0, write=60.0, pool=30.0)
|
|
10
|
-
self.__async_client = AsyncClient(
|
|
11
|
-
base_url="http://k5.takesend.com:8180",
|
|
12
|
-
timeout=timeout,
|
|
13
|
-
verify=False
|
|
14
|
-
)
|
|
15
|
-
self.__username = username
|
|
16
|
-
self.__password = password
|
|
17
|
-
|
|
18
|
-
async def login(self):
|
|
19
|
-
"""
|
|
20
|
-
自动登录
|
|
21
|
-
:return:
|
|
22
|
-
"""
|
|
23
|
-
# 访问首页
|
|
24
|
-
await self.__async_client.get("/c_index.jsp")
|
|
25
|
-
# 登录
|
|
26
|
-
params = {
|
|
27
|
-
'action': 'logon'
|
|
28
|
-
}
|
|
29
|
-
data = {
|
|
30
|
-
'userid': self.__username,
|
|
31
|
-
'password': self.__password
|
|
32
|
-
}
|
|
33
|
-
# 请求登录接口
|
|
34
|
-
await self.__async_client.post(".//client/Logon", params=params, data=data, headers=LOGIN_HEADERS)
|
|
35
|
-
|
|
36
|
-
async def client_cc_order(self, excel_data: list | str):
|
|
37
|
-
"""
|
|
38
|
-
修改泰嘉产品上传重量数据
|
|
39
|
-
:param excel_data:
|
|
40
|
-
:return:
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
params = {
|
|
44
|
-
'action': 'updateDweight',
|
|
45
|
-
}
|
|
46
|
-
data = {
|
|
47
|
-
'excel[]': excel_data,
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
response = await self.__async_client.post('/Client/CCOrder', params=params, data=data, headers=EDIT_HEADERS)
|
|
51
|
-
return response.json()
|
|
52
|
-
|
|
53
|
-
async def __aenter__(self):
|
|
54
|
-
return self
|
|
55
|
-
|
|
56
|
-
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
57
|
-
await self.__async_client.aclose()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/constant/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/exception/__init__.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/exception/common.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/ebay_product.py
RENAMED
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/purchase.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/tracking.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/parser/warehouse.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/ebay_product.py
RENAMED
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/tracking.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/dxm/schemas/warehouse.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/parser/__init__.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/four_seller/parser/order.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/query/order.py
RENAMED
|
File without changes
|
{ey_commerce_lib-1.0.22 → ey_commerce_lib-1.0.24}/src/ey_commerce_lib/kogan/schemas/query/product.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ey_commerce_lib-1.0.22/tests → ey_commerce_lib-1.0.24/src/ey_commerce_lib/utils}/__init__.py
RENAMED
|
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
|