fiuai-sdk-python 0.2.4__tar.gz → 0.2.6__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.
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/PKG-INFO +1 -1
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/pyproject.toml +1 -1
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/bank.py +7 -7
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/client.py +9 -2
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/company.py +1 -4
- fiuai_sdk_python-0.2.6/src/fiuai_sdk_python/perm.py +8 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/type.py +44 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/.gitignore +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/CHANGELOG.md +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/LICENSE +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/README.md +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/__init__.py +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/const.py +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/error.py +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/item.py +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/setup.py +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/token.py +0 -0
- {fiuai_sdk_python-0.2.4 → fiuai_sdk_python-0.2.6}/src/fiuai_sdk_python/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fiuai_sdk_python
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: FiuAI Python SDK - 企业级AI服务集成开发工具包
|
|
5
5
|
Project-URL: Homepage, https://github.com/fiuai/fiuai-sdk-python
|
|
6
6
|
Project-URL: Documentation, https://github.com/fiuai/fiuai-sdk-python#readme
|
|
@@ -110,30 +110,30 @@ def get_bank_account_by_bank_id(client: FiuaiSDK, bank_id: str) -> BankAccount|N
|
|
|
110
110
|
|
|
111
111
|
# 获取支行信息
|
|
112
112
|
bank_branch = ""
|
|
113
|
-
if resp[
|
|
113
|
+
if resp["opening_bank_branch"] != "":
|
|
114
114
|
_bank_branch = client.get_doc(
|
|
115
115
|
doctype="Bank Branch",
|
|
116
|
-
name=resp[
|
|
116
|
+
name=resp["opening_bank_branch"],
|
|
117
117
|
fields=["name", "bank_branch_name"]
|
|
118
118
|
)
|
|
119
119
|
if not _bank_branch:
|
|
120
|
-
logger.error(f"bank branch is not found by id {resp[
|
|
120
|
+
logger.error(f"bank branch is not found by id {resp["opening_bank_branch"]}")
|
|
121
121
|
return None
|
|
122
122
|
else:
|
|
123
|
-
bank_branch = _bank_branch[
|
|
123
|
+
bank_branch = _bank_branch["bank_branch_name"]
|
|
124
124
|
|
|
125
125
|
# 获取银行信息
|
|
126
126
|
_bank_detail = client.get_doc(
|
|
127
127
|
doctype="Bank",
|
|
128
|
-
name=resp[
|
|
128
|
+
name=resp["bank"],
|
|
129
129
|
fields=["name", "bank_name"]
|
|
130
130
|
)
|
|
131
131
|
|
|
132
132
|
if not _bank_detail:
|
|
133
|
-
logger.error(f"bank is not found by id {resp[
|
|
133
|
+
logger.error(f"bank is not found by id {resp["bank"]}")
|
|
134
134
|
return None
|
|
135
135
|
|
|
136
|
-
_bank_account = resp
|
|
136
|
+
_bank_account = resp
|
|
137
137
|
return BankAccount(
|
|
138
138
|
name=_bank_account["name"],
|
|
139
139
|
account_name=_bank_account.get("account_name", "") if _bank_account.get("account_name", "") else "",
|
|
@@ -77,7 +77,9 @@ class FiuaiSDK(object):
|
|
|
77
77
|
|
|
78
78
|
def _logout(self):
|
|
79
79
|
logger.info(f"Logout from {self.url}")
|
|
80
|
-
self.
|
|
80
|
+
if self.auth_type == "password":
|
|
81
|
+
# internal login 不需要logout
|
|
82
|
+
self.client.get(self.url, params={"cmd": "logout"}, headers=self.headers)
|
|
81
83
|
|
|
82
84
|
|
|
83
85
|
def __enter__(self):
|
|
@@ -205,7 +207,12 @@ class FiuaiSDK(object):
|
|
|
205
207
|
res = self.client.get(self.url + '/api/resource/' + doctype + '/' + name,
|
|
206
208
|
params=params, headers=self.headers)
|
|
207
209
|
|
|
208
|
-
|
|
210
|
+
|
|
211
|
+
docs = self.post_process(res)
|
|
212
|
+
if isinstance(docs, list):
|
|
213
|
+
return docs[0]
|
|
214
|
+
else:
|
|
215
|
+
return docs
|
|
209
216
|
|
|
210
217
|
|
|
211
218
|
def get_api(self, method, params={}):
|
|
@@ -44,7 +44,6 @@ def get_target_company_by_name(client: FiuaiSDK, full_name: str, target_side: Li
|
|
|
44
44
|
logger.debug(f"get_target_company_by_name: {full_name} not found")
|
|
45
45
|
return TargetCompanySearchResult(name="", full_name="", unique_no="", exists=False, in_network=False, comment="该公司不存在")
|
|
46
46
|
|
|
47
|
-
_lookup = _lookup[0]
|
|
48
47
|
|
|
49
48
|
_network = client.get_doc(
|
|
50
49
|
doctype="Company Network",
|
|
@@ -54,8 +53,6 @@ def get_target_company_by_name(client: FiuaiSDK, full_name: str, target_side: Li
|
|
|
54
53
|
logger.debug(f"get_target_company_by_name: {full_name} is not in network")
|
|
55
54
|
return TargetCompanySearchResult(name="", full_name="", unique_no="", exists=True, in_network=False, comment="该公司不在本方网络中")
|
|
56
55
|
|
|
57
|
-
_network = _network[0]
|
|
58
|
-
|
|
59
56
|
|
|
60
57
|
n = TargetCompanySearchResult(
|
|
61
58
|
name=_network["target_company_id"],
|
|
@@ -98,7 +95,7 @@ def get_company_profile(client: FiuaiSDK, auth_company_id: str)-> CompanyProfile
|
|
|
98
95
|
if not resp:
|
|
99
96
|
return None
|
|
100
97
|
|
|
101
|
-
r = resp
|
|
98
|
+
r = resp
|
|
102
99
|
|
|
103
100
|
if r["default_bank_account"]:
|
|
104
101
|
rr = get_bank_account_by_bank_id(client, r["default_bank_account"])
|
|
@@ -12,7 +12,21 @@ from datetime import datetime
|
|
|
12
12
|
import json
|
|
13
13
|
import re
|
|
14
14
|
from .token import TokenConfig
|
|
15
|
+
from enum import StrEnum
|
|
15
16
|
|
|
17
|
+
|
|
18
|
+
########## client type ##########
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ClientConfig(BaseModel):
|
|
22
|
+
url: str
|
|
23
|
+
max_api_retry: int
|
|
24
|
+
timeout: int
|
|
25
|
+
verify: bool
|
|
26
|
+
tokens: List[TokenConfig] = []
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
########## user type ##########
|
|
16
30
|
class UserProfile(BaseModel):
|
|
17
31
|
name: str = Field(description="用户名称")
|
|
18
32
|
full_name: str = Field(description="用户全名")
|
|
@@ -22,6 +36,36 @@ class UserProfile(BaseModel):
|
|
|
22
36
|
default_company_id: str = Field(description="用户默认公司", default="")
|
|
23
37
|
phone: str = Field(description="用户电话", default="")
|
|
24
38
|
|
|
39
|
+
class DocTypePermission(StrEnum):
|
|
40
|
+
SELECT = "can_select"
|
|
41
|
+
READ = "can_read"
|
|
42
|
+
WRITE = "can_write"
|
|
43
|
+
CREATE = "can_create"
|
|
44
|
+
DELETE = "can_delete"
|
|
45
|
+
SUBMIT = "can_submit"
|
|
46
|
+
CANCEL = "can_cancel"
|
|
47
|
+
AMEND = "can_amend"
|
|
48
|
+
APPROVE = "can_approve"
|
|
49
|
+
EXPORT = "can_export"
|
|
50
|
+
IMPORT = "can_import"
|
|
51
|
+
|
|
52
|
+
class UserDocTypePermission(BaseModel):
|
|
53
|
+
can_select: bool
|
|
54
|
+
can_read: bool
|
|
55
|
+
can_write: bool
|
|
56
|
+
can_create: bool
|
|
57
|
+
can_delete: bool
|
|
58
|
+
can_submit: bool
|
|
59
|
+
can_cancel: bool
|
|
60
|
+
can_amend: bool
|
|
61
|
+
can_approve: bool
|
|
62
|
+
can_export: bool
|
|
63
|
+
can_import: bool
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
########## basic ##########
|
|
68
|
+
|
|
25
69
|
|
|
26
70
|
class ClientConfig(BaseModel):
|
|
27
71
|
url: str
|
|
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
|
|
File without changes
|