codosdk 1.0.9__tar.gz → 1.0.11__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.
- codosdk-1.0.11/PKG-INFO +98 -0
- codosdk-1.0.11/codosdk.egg-info/PKG-INFO +98 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/codosdk.egg-info/SOURCES.txt +1 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/setup.py +9 -6
- codosdk-1.0.11/websdk2/crud_utils.py +148 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/model_utils.py +1 -1
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/tools.py +1 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/utils/pydantic_utils.py +1 -1
- codosdk-1.0.9/PKG-INFO +0 -45
- codosdk-1.0.9/codosdk.egg-info/PKG-INFO +0 -45
- {codosdk-1.0.9 → codosdk-1.0.11}/LICENSE +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/README.md +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/codosdk.egg-info/dependency_links.txt +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/codosdk.egg-info/requires.txt +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/codosdk.egg-info/top_level.txt +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/opssdk/__init__.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/opssdk/utils/__init__.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/pyproject.toml +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/setup.cfg +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/__init__.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/api_set.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/apis/__init__.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/apis/admin_apis.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/apis/agent_apis.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/apis/cmdb_apis.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/apis/kerrigan_apis.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/apis/mgv4_apis.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/apis/task_apis.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/application.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/base_handler.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/cache.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/cache_context.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/client.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/cloud/__init__.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/cloud/qcloud_api.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/cloud/ucloud_api.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/cloud_utils.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/configs.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/consts.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/db_context.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/error.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/fetch_coroutine.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/jwt_token.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/ldap.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/logger.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/mqhelper.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/program.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/salt_api.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/sqlalchemy_pagination.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/utils/__init__.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/utils/cc_crypto.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/utils/date_format.py +0 -0
- {codosdk-1.0.9 → codosdk-1.0.11}/websdk2/web_logs.py +0 -0
codosdk-1.0.11/PKG-INFO
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: codosdk
|
|
3
|
+
Version: 1.0.11
|
|
4
|
+
Summary: CODO项目的Python SDK
|
|
5
|
+
Home-page: https://github.com/ss1917/codo_sdk/
|
|
6
|
+
Author: shenshuo
|
|
7
|
+
Author-email: 191715030@qq.com
|
|
8
|
+
License: GPLv3
|
|
9
|
+
Keywords: ops,codo,devops
|
|
10
|
+
Platform: any
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console :: Curses
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Requires-Python: >=2.7, >=3.6
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: fire==0.5.0
|
|
24
|
+
Requires-Dist: shortuuid==1.0.11
|
|
25
|
+
Requires-Dist: pymysql==0.9.3
|
|
26
|
+
Requires-Dist: sqlalchemy==1.3.23
|
|
27
|
+
Requires-Dist: pika==1.3.1
|
|
28
|
+
Requires-Dist: PyJWT==2.0.1
|
|
29
|
+
Requires-Dist: requests==2.28.2
|
|
30
|
+
Requires-Dist: redis==4.5.1
|
|
31
|
+
Requires-Dist: tornado>=6.0
|
|
32
|
+
Requires-Dist: loguru>=0.6.0
|
|
33
|
+
Requires-Dist: cryptography==42.0.4
|
|
34
|
+
Requires-Dist: ldap3==2.9
|
|
35
|
+
Requires-Dist: pydantic>=1.10.5
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: author-email
|
|
38
|
+
Dynamic: classifier
|
|
39
|
+
Dynamic: description
|
|
40
|
+
Dynamic: description-content-type
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: keywords
|
|
43
|
+
Dynamic: license
|
|
44
|
+
Dynamic: platform
|
|
45
|
+
Dynamic: requires-dist
|
|
46
|
+
Dynamic: requires-python
|
|
47
|
+
Dynamic: summary
|
|
48
|
+
|
|
49
|
+
## 安装
|
|
50
|
+
|
|
51
|
+
### python3安装
|
|
52
|
+
|
|
53
|
+
[python链接](https://www.python.org/)
|
|
54
|
+
|
|
55
|
+
##### python3.9以上
|
|
56
|
+
|
|
57
|
+
##### SDK 安装
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
$ pip3 install -U git+https://github.com/ss1917/ops_sdk.git
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 结构
|
|
64
|
+
|
|
65
|
+
```shell
|
|
66
|
+
.
|
|
67
|
+
├── README.md 项目readme
|
|
68
|
+
└── opssdk
|
|
69
|
+
├── logs 日志模块
|
|
70
|
+
├── install 安装模块
|
|
71
|
+
├── get_info 配置获取
|
|
72
|
+
└── operate 运维操作
|
|
73
|
+
├── check 系统参数检查和获取
|
|
74
|
+
├── mysql mysql 操作
|
|
75
|
+
├── mail 发送邮件
|
|
76
|
+
└── centralization 集中化管理工具 salt
|
|
77
|
+
└── websdk2 web开发使用
|
|
78
|
+
├── application.py tornado application
|
|
79
|
+
├── base_handler.py tornado 基类
|
|
80
|
+
├── cache.py 处理redis缓存
|
|
81
|
+
├── configs.py 配置文件管理
|
|
82
|
+
├── consts.py 常量
|
|
83
|
+
├── db_context.py MySQL 处理类
|
|
84
|
+
├── error.py 异常
|
|
85
|
+
├── fetch_coroutine.py
|
|
86
|
+
├── __init__.py
|
|
87
|
+
├── jwt_token.py jwt
|
|
88
|
+
├── mqhelper.py MQ 处理类
|
|
89
|
+
├── program.py
|
|
90
|
+
├── salt_api.py salt 处理类 可以移到工具类
|
|
91
|
+
├── sms.py 发送短信 可以移到工具类
|
|
92
|
+
├── tools.py 工具类
|
|
93
|
+
└── web_logs.py 日志处理
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
Everything is [GPL v3.0](https://www.gnu.org/licenses/gpl-3.0.html).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: codosdk
|
|
3
|
+
Version: 1.0.11
|
|
4
|
+
Summary: CODO项目的Python SDK
|
|
5
|
+
Home-page: https://github.com/ss1917/codo_sdk/
|
|
6
|
+
Author: shenshuo
|
|
7
|
+
Author-email: 191715030@qq.com
|
|
8
|
+
License: GPLv3
|
|
9
|
+
Keywords: ops,codo,devops
|
|
10
|
+
Platform: any
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console :: Curses
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Requires-Python: >=2.7, >=3.6
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: fire==0.5.0
|
|
24
|
+
Requires-Dist: shortuuid==1.0.11
|
|
25
|
+
Requires-Dist: pymysql==0.9.3
|
|
26
|
+
Requires-Dist: sqlalchemy==1.3.23
|
|
27
|
+
Requires-Dist: pika==1.3.1
|
|
28
|
+
Requires-Dist: PyJWT==2.0.1
|
|
29
|
+
Requires-Dist: requests==2.28.2
|
|
30
|
+
Requires-Dist: redis==4.5.1
|
|
31
|
+
Requires-Dist: tornado>=6.0
|
|
32
|
+
Requires-Dist: loguru>=0.6.0
|
|
33
|
+
Requires-Dist: cryptography==42.0.4
|
|
34
|
+
Requires-Dist: ldap3==2.9
|
|
35
|
+
Requires-Dist: pydantic>=1.10.5
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: author-email
|
|
38
|
+
Dynamic: classifier
|
|
39
|
+
Dynamic: description
|
|
40
|
+
Dynamic: description-content-type
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: keywords
|
|
43
|
+
Dynamic: license
|
|
44
|
+
Dynamic: platform
|
|
45
|
+
Dynamic: requires-dist
|
|
46
|
+
Dynamic: requires-python
|
|
47
|
+
Dynamic: summary
|
|
48
|
+
|
|
49
|
+
## 安装
|
|
50
|
+
|
|
51
|
+
### python3安装
|
|
52
|
+
|
|
53
|
+
[python链接](https://www.python.org/)
|
|
54
|
+
|
|
55
|
+
##### python3.9以上
|
|
56
|
+
|
|
57
|
+
##### SDK 安装
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
$ pip3 install -U git+https://github.com/ss1917/ops_sdk.git
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 结构
|
|
64
|
+
|
|
65
|
+
```shell
|
|
66
|
+
.
|
|
67
|
+
├── README.md 项目readme
|
|
68
|
+
└── opssdk
|
|
69
|
+
├── logs 日志模块
|
|
70
|
+
├── install 安装模块
|
|
71
|
+
├── get_info 配置获取
|
|
72
|
+
└── operate 运维操作
|
|
73
|
+
├── check 系统参数检查和获取
|
|
74
|
+
├── mysql mysql 操作
|
|
75
|
+
├── mail 发送邮件
|
|
76
|
+
└── centralization 集中化管理工具 salt
|
|
77
|
+
└── websdk2 web开发使用
|
|
78
|
+
├── application.py tornado application
|
|
79
|
+
├── base_handler.py tornado 基类
|
|
80
|
+
├── cache.py 处理redis缓存
|
|
81
|
+
├── configs.py 配置文件管理
|
|
82
|
+
├── consts.py 常量
|
|
83
|
+
├── db_context.py MySQL 处理类
|
|
84
|
+
├── error.py 异常
|
|
85
|
+
├── fetch_coroutine.py
|
|
86
|
+
├── __init__.py
|
|
87
|
+
├── jwt_token.py jwt
|
|
88
|
+
├── mqhelper.py MQ 处理类
|
|
89
|
+
├── program.py
|
|
90
|
+
├── salt_api.py salt 处理类 可以移到工具类
|
|
91
|
+
├── sms.py 发送短信 可以移到工具类
|
|
92
|
+
├── tools.py 工具类
|
|
93
|
+
└── web_logs.py 日志处理
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
Everything is [GPL v3.0](https://www.gnu.org/licenses/gpl-3.0.html).
|
|
@@ -7,9 +7,9 @@ desc : CODO SDK
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import sys
|
|
10
|
-
from
|
|
10
|
+
from setuptools import setup, find_packages
|
|
11
11
|
|
|
12
|
-
VERSION = '1.0.
|
|
12
|
+
VERSION = '1.0.11'
|
|
13
13
|
|
|
14
14
|
if sys.version_info < (2, 7) or (3, 0) <= sys.version_info < (3, 6):
|
|
15
15
|
print('This program requires at least Python 2.7 or 3.6 to run.')
|
|
@@ -34,14 +34,16 @@ setup(
|
|
|
34
34
|
name='codosdk',
|
|
35
35
|
version=VERSION,
|
|
36
36
|
description="CODO项目的Python SDK",
|
|
37
|
-
packages=['opssdk', 'opssdk.utils', 'websdk2', 'websdk2.apis', 'websdk2.cloud', 'websdk2.utils'],
|
|
37
|
+
# packages=['opssdk', 'opssdk.utils', 'websdk2', 'websdk2.apis', 'websdk2.cloud', 'websdk2.utils'],
|
|
38
|
+
packages=find_packages(),
|
|
38
39
|
url='https://github.com/ss1917/codo_sdk/',
|
|
39
40
|
license='GPLv3',
|
|
40
|
-
keywords="ops,
|
|
41
|
+
keywords="ops, codo, devops",
|
|
41
42
|
install_requires=get_install_requires(),
|
|
42
43
|
author='shenshuo',
|
|
43
44
|
author_email='191715030@qq.com',
|
|
44
|
-
long_description='
|
|
45
|
+
long_description=open('README.md').read(), # 自动读取README文件
|
|
46
|
+
long_description_content_type='text/markdown', # 确保Markdown格式
|
|
45
47
|
include_package_data=True,
|
|
46
48
|
data_files=get_data_files(),
|
|
47
49
|
classifiers=[
|
|
@@ -55,5 +57,6 @@ setup(
|
|
|
55
57
|
'Programming Language :: Python :: 3.9',
|
|
56
58
|
'Programming Language :: Python :: 3.9'
|
|
57
59
|
],
|
|
58
|
-
platforms='any'
|
|
60
|
+
platforms='any',
|
|
61
|
+
python_requires='>=2.7, >=3.6', # 精确控制支持的Python版本
|
|
59
62
|
)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*-coding:utf-8-*-
|
|
3
|
+
"""
|
|
4
|
+
Author : shenshuo
|
|
5
|
+
Date : 2025年02月08日
|
|
6
|
+
Desc : 存储类
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import logging
|
|
10
|
+
from sqlalchemy import true
|
|
11
|
+
from sqlalchemy.exc import IntegrityError
|
|
12
|
+
from .db_context import DBContextV2 as DBContext
|
|
13
|
+
from .utils.pydantic_utils import sqlalchemy_to_pydantic, ValidationError, PydanticDelList
|
|
14
|
+
from .sqlalchemy_pagination import paginate
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ModelCRUDView:
|
|
18
|
+
def __init__(self, model, **kwargs):
|
|
19
|
+
self.model = model
|
|
20
|
+
self.pydantic_model_base = sqlalchemy_to_pydantic(model)
|
|
21
|
+
self.pydantic_model = sqlalchemy_to_pydantic(model, exclude=['id'])
|
|
22
|
+
|
|
23
|
+
def prepare(self):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
@staticmethod
|
|
27
|
+
def del_data(data) -> dict:
|
|
28
|
+
for key in ['_index', '_rowKey', 'update_time']:
|
|
29
|
+
data.pop(key, None)
|
|
30
|
+
return data
|
|
31
|
+
|
|
32
|
+
def handle_get(self, data: dict) -> dict:
|
|
33
|
+
self.prepare()
|
|
34
|
+
data_id = data.get('id')
|
|
35
|
+
if not data_id:
|
|
36
|
+
return dict(code=1, msg="缺少必要的 'id' 参数", data=None)
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
with DBContext('r') as session:
|
|
40
|
+
_info = session.query(self.model).filter(self.model.id == data_id).first()
|
|
41
|
+
if not _info:
|
|
42
|
+
return dict(code=1, msg='数据未找到', data=None)
|
|
43
|
+
return dict(code=0, msg='获取成功', data={
|
|
44
|
+
data: _info.to_dict()
|
|
45
|
+
})
|
|
46
|
+
except Exception as e:
|
|
47
|
+
logging.error(f"Database query failed: {e}")
|
|
48
|
+
return dict(code=2, msg='查询失败', data=None)
|
|
49
|
+
|
|
50
|
+
def handle_list(self, params: dict, get_by_val_func=None) -> dict:
|
|
51
|
+
self.prepare()
|
|
52
|
+
|
|
53
|
+
value = params.get('searchValue', params.get('searchVal'))
|
|
54
|
+
filter_map = params.pop('filter_map', {})
|
|
55
|
+
params.setdefault('page_size', 300) # 统一处理默认值
|
|
56
|
+
|
|
57
|
+
# 如果未提供过滤函数,使用默认函数
|
|
58
|
+
if get_by_val_func is None:
|
|
59
|
+
def default_get_by_val(value: str):
|
|
60
|
+
"""默认返回不过滤"""
|
|
61
|
+
return true()
|
|
62
|
+
|
|
63
|
+
get_by_val_func = default_get_by_val
|
|
64
|
+
|
|
65
|
+
if not callable(get_by_val_func):
|
|
66
|
+
raise ValueError("The `get_by_val_func` parameter must be a callable function.")
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
# 调用 get_by_val_func 生成过滤条件
|
|
70
|
+
filter_condition = get_by_val_func(value)
|
|
71
|
+
if not isinstance(filter_condition, (bool, type(true()))):
|
|
72
|
+
raise ValueError("The `get_by_val_func` must return a SQLAlchemy filter condition or a boolean.")
|
|
73
|
+
|
|
74
|
+
except Exception as e:
|
|
75
|
+
raise ValueError(f"Error while executing `get_by_val_func`: {e}")
|
|
76
|
+
|
|
77
|
+
with DBContext('r') as session:
|
|
78
|
+
query = session.query(self.model).filter(filter_condition).filter_by(**filter_map)
|
|
79
|
+
page = paginate(query, **params)
|
|
80
|
+
|
|
81
|
+
return dict(
|
|
82
|
+
code=0,
|
|
83
|
+
msg='获取成功',
|
|
84
|
+
data={
|
|
85
|
+
'items': page.items,
|
|
86
|
+
'current_page': page.page, # 当前页
|
|
87
|
+
'total_pages': page.pages, # 总页数
|
|
88
|
+
'count': page.total # 总数
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
def handle_add(self, data: dict) -> dict:
|
|
93
|
+
self.prepare()
|
|
94
|
+
data = self.del_data(data)
|
|
95
|
+
try:
|
|
96
|
+
self.pydantic_model(**data)
|
|
97
|
+
except ValidationError as e:
|
|
98
|
+
return dict(code=-1, msg=str(e))
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
with DBContext('w', None, True) as db:
|
|
102
|
+
db.add(self.model(**data))
|
|
103
|
+
except IntegrityError as e:
|
|
104
|
+
return dict(code=-2, msg='不要重复添加')
|
|
105
|
+
|
|
106
|
+
except Exception as e:
|
|
107
|
+
return dict(code=-3, msg=f'{e}')
|
|
108
|
+
|
|
109
|
+
return dict(code=0, msg="创建成功")
|
|
110
|
+
|
|
111
|
+
def handle_update(self, data: dict) -> dict:
|
|
112
|
+
self.prepare()
|
|
113
|
+
data = self.del_data(data)
|
|
114
|
+
try:
|
|
115
|
+
valid_data = self.pydantic_model_base(**data)
|
|
116
|
+
except ValidationError as e:
|
|
117
|
+
return dict(code=-1, msg=str(e))
|
|
118
|
+
|
|
119
|
+
try:
|
|
120
|
+
with DBContext('w', None, True) as db:
|
|
121
|
+
db.query(self.model).filter(self.model.id == valid_data.id).update(data)
|
|
122
|
+
|
|
123
|
+
except IntegrityError as e:
|
|
124
|
+
return dict(code=-2, msg=f'修改失败,已存在')
|
|
125
|
+
|
|
126
|
+
except Exception as err:
|
|
127
|
+
return dict(code=-3, msg=f'修改失败, {err}')
|
|
128
|
+
|
|
129
|
+
return dict(code=0, msg="修改成功")
|
|
130
|
+
|
|
131
|
+
def handle_update_no_validation(self, data: dict) -> dict:
|
|
132
|
+
"""不进行校验的更新方法"""
|
|
133
|
+
self.prepare()
|
|
134
|
+
data_id = data.get('id')
|
|
135
|
+
with DBContext('w', None, True) as db:
|
|
136
|
+
db.query(self.model).filter(self.model.id == data_id).update(data)
|
|
137
|
+
return dict(code=0, msg='更新成功')
|
|
138
|
+
|
|
139
|
+
def handle_delete(self, data: dict) -> dict:
|
|
140
|
+
self.prepare()
|
|
141
|
+
try:
|
|
142
|
+
valid_data = PydanticDelList(**data)
|
|
143
|
+
except ValidationError as e:
|
|
144
|
+
return dict(code=-1, msg=str(e))
|
|
145
|
+
|
|
146
|
+
with DBContext('w', None, True) as session:
|
|
147
|
+
session.query(self.model).filter(self.model.id.in_(valid_data.id_list)).delete(synchronize_session=False)
|
|
148
|
+
return dict(code=0, msg=f"删除成功")
|
codosdk-1.0.9/PKG-INFO
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: codosdk
|
|
3
|
-
Version: 1.0.9
|
|
4
|
-
Summary: CODO项目的Python SDK
|
|
5
|
-
Home-page: https://github.com/ss1917/codo_sdk/
|
|
6
|
-
Author: shenshuo
|
|
7
|
-
Author-email: 191715030@qq.com
|
|
8
|
-
License: GPLv3
|
|
9
|
-
Keywords: ops,opencodo,devops
|
|
10
|
-
Platform: any
|
|
11
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
-
Classifier: Environment :: Console :: Curses
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: fire==0.5.0
|
|
22
|
-
Requires-Dist: shortuuid==1.0.11
|
|
23
|
-
Requires-Dist: pymysql==0.9.3
|
|
24
|
-
Requires-Dist: sqlalchemy==1.3.23
|
|
25
|
-
Requires-Dist: pika==1.3.1
|
|
26
|
-
Requires-Dist: PyJWT==2.0.1
|
|
27
|
-
Requires-Dist: requests==2.28.2
|
|
28
|
-
Requires-Dist: redis==4.5.1
|
|
29
|
-
Requires-Dist: tornado>=6.0
|
|
30
|
-
Requires-Dist: loguru>=0.6.0
|
|
31
|
-
Requires-Dist: cryptography==42.0.4
|
|
32
|
-
Requires-Dist: ldap3==2.9
|
|
33
|
-
Requires-Dist: pydantic>=1.10.5
|
|
34
|
-
Dynamic: author
|
|
35
|
-
Dynamic: author-email
|
|
36
|
-
Dynamic: classifier
|
|
37
|
-
Dynamic: description
|
|
38
|
-
Dynamic: home-page
|
|
39
|
-
Dynamic: keywords
|
|
40
|
-
Dynamic: license
|
|
41
|
-
Dynamic: platform
|
|
42
|
-
Dynamic: requires-dist
|
|
43
|
-
Dynamic: summary
|
|
44
|
-
|
|
45
|
-
SDK of the operation and maintenance script logs operate
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: codosdk
|
|
3
|
-
Version: 1.0.9
|
|
4
|
-
Summary: CODO项目的Python SDK
|
|
5
|
-
Home-page: https://github.com/ss1917/codo_sdk/
|
|
6
|
-
Author: shenshuo
|
|
7
|
-
Author-email: 191715030@qq.com
|
|
8
|
-
License: GPLv3
|
|
9
|
-
Keywords: ops,opencodo,devops
|
|
10
|
-
Platform: any
|
|
11
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
-
Classifier: Environment :: Console :: Curses
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: fire==0.5.0
|
|
22
|
-
Requires-Dist: shortuuid==1.0.11
|
|
23
|
-
Requires-Dist: pymysql==0.9.3
|
|
24
|
-
Requires-Dist: sqlalchemy==1.3.23
|
|
25
|
-
Requires-Dist: pika==1.3.1
|
|
26
|
-
Requires-Dist: PyJWT==2.0.1
|
|
27
|
-
Requires-Dist: requests==2.28.2
|
|
28
|
-
Requires-Dist: redis==4.5.1
|
|
29
|
-
Requires-Dist: tornado>=6.0
|
|
30
|
-
Requires-Dist: loguru>=0.6.0
|
|
31
|
-
Requires-Dist: cryptography==42.0.4
|
|
32
|
-
Requires-Dist: ldap3==2.9
|
|
33
|
-
Requires-Dist: pydantic>=1.10.5
|
|
34
|
-
Dynamic: author
|
|
35
|
-
Dynamic: author-email
|
|
36
|
-
Dynamic: classifier
|
|
37
|
-
Dynamic: description
|
|
38
|
-
Dynamic: home-page
|
|
39
|
-
Dynamic: keywords
|
|
40
|
-
Dynamic: license
|
|
41
|
-
Dynamic: platform
|
|
42
|
-
Dynamic: requires-dist
|
|
43
|
-
Dynamic: summary
|
|
44
|
-
|
|
45
|
-
SDK of the operation and maintenance script logs operate
|
|
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
|
|
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
|
|
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
|
|
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
|