lingxingapi 1.1.4__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.
- lingxingapi/__init__.py +7 -0
- lingxingapi/ads/__init__.py +0 -0
- lingxingapi/ads/api.py +5946 -0
- lingxingapi/ads/param.py +192 -0
- lingxingapi/ads/route.py +134 -0
- lingxingapi/ads/schema.py +2615 -0
- lingxingapi/api.py +557 -0
- lingxingapi/base/__init__.py +0 -0
- lingxingapi/base/api.py +568 -0
- lingxingapi/base/param.py +59 -0
- lingxingapi/base/route.py +11 -0
- lingxingapi/base/schema.py +198 -0
- lingxingapi/basic/__init__.py +0 -0
- lingxingapi/basic/api.py +466 -0
- lingxingapi/basic/param.py +72 -0
- lingxingapi/basic/route.py +20 -0
- lingxingapi/basic/schema.py +218 -0
- lingxingapi/errors.py +152 -0
- lingxingapi/fba/__init__.py +0 -0
- lingxingapi/fba/api.py +1691 -0
- lingxingapi/fba/param.py +250 -0
- lingxingapi/fba/route.py +30 -0
- lingxingapi/fba/schema.py +987 -0
- lingxingapi/fields.py +50 -0
- lingxingapi/finance/__init__.py +0 -0
- lingxingapi/finance/api.py +3091 -0
- lingxingapi/finance/param.py +616 -0
- lingxingapi/finance/route.py +44 -0
- lingxingapi/finance/schema.py +1243 -0
- lingxingapi/product/__init__.py +0 -0
- lingxingapi/product/api.py +2643 -0
- lingxingapi/product/param.py +934 -0
- lingxingapi/product/route.py +49 -0
- lingxingapi/product/schema.py +1004 -0
- lingxingapi/purchase/__init__.py +0 -0
- lingxingapi/purchase/api.py +496 -0
- lingxingapi/purchase/param.py +126 -0
- lingxingapi/purchase/route.py +11 -0
- lingxingapi/purchase/schema.py +215 -0
- lingxingapi/sales/__init__.py +0 -0
- lingxingapi/sales/api.py +3200 -0
- lingxingapi/sales/param.py +723 -0
- lingxingapi/sales/route.py +70 -0
- lingxingapi/sales/schema.py +1718 -0
- lingxingapi/source/__init__.py +0 -0
- lingxingapi/source/api.py +1799 -0
- lingxingapi/source/param.py +176 -0
- lingxingapi/source/route.py +38 -0
- lingxingapi/source/schema.py +1011 -0
- lingxingapi/tools/__init__.py +0 -0
- lingxingapi/tools/api.py +291 -0
- lingxingapi/tools/param.py +73 -0
- lingxingapi/tools/route.py +8 -0
- lingxingapi/tools/schema.py +169 -0
- lingxingapi/utils.py +456 -0
- lingxingapi/warehourse/__init__.py +0 -0
- lingxingapi/warehourse/api.py +1778 -0
- lingxingapi/warehourse/param.py +506 -0
- lingxingapi/warehourse/route.py +28 -0
- lingxingapi/warehourse/schema.py +926 -0
- lingxingapi-1.1.4.dist-info/METADATA +73 -0
- lingxingapi-1.1.4.dist-info/RECORD +65 -0
- lingxingapi-1.1.4.dist-info/WHEEL +5 -0
- lingxingapi-1.1.4.dist-info/licenses/LICENSE +22 -0
- lingxingapi-1.1.4.dist-info/top_level.txt +1 -0
lingxingapi/fields.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from typing import Annotated
|
|
3
|
+
from pydantic_core import CoreSchema, core_schema
|
|
4
|
+
from pydantic import GetCoreSchemaHandler, Field
|
|
5
|
+
from pydantic import NonNegativeInt, NonNegativeFloat
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Custom Field -----------------------------------------------------------------------------------------------------------------
|
|
9
|
+
NonEmptyStr = Annotated[str, Field(min_length=1)] # 非空字符串
|
|
10
|
+
CountryCode = Annotated[str, Field(min_length=2, max_length=2)] # 国家代码, 2位字符
|
|
11
|
+
CurrencyCode = Annotated[str, Field(min_length=3, max_length=3)] # 货币代码, 3位字符
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class IntOrNone2Zero(int):
|
|
15
|
+
"""自定义 int 数据类型解析
|
|
16
|
+
|
|
17
|
+
- 当传入 None 或空字符串时, 返回 0
|
|
18
|
+
- 其他情况按正常的 int 处理
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __get_pydantic_core_schema__(self, handler: GetCoreSchemaHandler) -> CoreSchema:
|
|
22
|
+
return core_schema.no_info_before_validator_function(
|
|
23
|
+
lambda v: 0 if v is None or v == "" else v, handler(int)
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class FloatOrNone2Zero(float):
|
|
28
|
+
"""自定义 float 数据类型解析
|
|
29
|
+
|
|
30
|
+
- 当传入 None 或空字符串时, 返回 0.0
|
|
31
|
+
- 其他情况按正常的 float 处理
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def __get_pydantic_core_schema__(self, handler: GetCoreSchemaHandler) -> CoreSchema:
|
|
35
|
+
return core_schema.no_info_before_validator_function(
|
|
36
|
+
lambda v: 0.0 if v is None or v == "" else v, handler(float)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class StrOrNone2Blank(str):
|
|
41
|
+
"""自定义 str 数据类型解析
|
|
42
|
+
|
|
43
|
+
- 当传入 None 时, 返回空字符串
|
|
44
|
+
- 其他情况按正常的 str 处理
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __get_pydantic_core_schema__(self, handler: GetCoreSchemaHandler) -> CoreSchema:
|
|
48
|
+
return core_schema.no_info_before_validator_function(
|
|
49
|
+
lambda v: "" if v is None else v, handler(str)
|
|
50
|
+
)
|
|
File without changes
|