codosdk 1.0.11__tar.gz → 1.0.13__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 → codosdk-1.0.13}/PKG-INFO +1 -1
- {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/PKG-INFO +1 -1
- {codosdk-1.0.11 → codosdk-1.0.13}/setup.py +1 -1
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/application.py +33 -17
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/crud_utils.py +1 -1
- {codosdk-1.0.11 → codosdk-1.0.13}/LICENSE +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/README.md +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/SOURCES.txt +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/dependency_links.txt +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/requires.txt +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/top_level.txt +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/opssdk/__init__.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/opssdk/utils/__init__.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/pyproject.toml +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/setup.cfg +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/__init__.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/api_set.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/__init__.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/admin_apis.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/agent_apis.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/cmdb_apis.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/kerrigan_apis.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/mgv4_apis.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/task_apis.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/base_handler.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cache.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cache_context.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/client.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud/__init__.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud/qcloud_api.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud/ucloud_api.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud_utils.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/configs.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/consts.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/db_context.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/error.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/fetch_coroutine.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/jwt_token.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/ldap.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/logger.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/model_utils.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/mqhelper.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/program.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/salt_api.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/sqlalchemy_pagination.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/tools.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/__init__.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/cc_crypto.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/date_format.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/pydantic_utils.py +0 -0
- {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/web_logs.py +0 -0
|
@@ -9,7 +9,7 @@ desc : CODO SDK
|
|
|
9
9
|
import sys
|
|
10
10
|
from setuptools import setup, find_packages
|
|
11
11
|
|
|
12
|
-
VERSION = '1.0.
|
|
12
|
+
VERSION = '1.0.13'
|
|
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.')
|
|
@@ -6,8 +6,8 @@ date : 2018年1月12日13:43:27
|
|
|
6
6
|
role : 定制 Application
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
import os
|
|
10
9
|
import logging
|
|
10
|
+
from abc import ABC
|
|
11
11
|
from shortuuid import uuid
|
|
12
12
|
from tornado import httpserver, ioloop
|
|
13
13
|
from tornado import options as tnd_options
|
|
@@ -30,10 +30,14 @@ class Application(tornadoApp):
|
|
|
30
30
|
|
|
31
31
|
def __init__(self, handlers=None, default_host="", transforms=None, **settings):
|
|
32
32
|
tnd_options.parse_command_line()
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
handlers = handlers or []
|
|
34
|
+
if configs.can_import:
|
|
35
|
+
configs.import_dict(**settings)
|
|
36
|
+
|
|
35
37
|
handlers.extend([(r"/v1/probe/meta/urls/", MetaProbe), ])
|
|
36
|
-
|
|
38
|
+
|
|
39
|
+
self._generate_url_metadata(handlers)
|
|
40
|
+
|
|
37
41
|
max_buffer_size = configs.get('max_buffer_size')
|
|
38
42
|
max_body_size = configs.get('max_body_size')
|
|
39
43
|
super(Application, self).__init__(handlers, default_host, transforms, **configs)
|
|
@@ -52,25 +56,37 @@ class Application(tornadoApp):
|
|
|
52
56
|
self.io_loop.start()
|
|
53
57
|
except KeyboardInterrupt:
|
|
54
58
|
self.io_loop.stop()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
logging.error(
|
|
59
|
+
logging.info("Server shut down gracefully.")
|
|
60
|
+
except Exception as e:
|
|
61
|
+
logging.error(f"Unexpected error: {e}", exc_info=True)
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
@staticmethod
|
|
64
|
+
def _generate_url_metadata(urls):
|
|
65
|
+
"""Generate metadata for registered URLs."""
|
|
66
|
+
for url in urls:
|
|
67
|
+
meta = {
|
|
68
|
+
"url": url[0],
|
|
69
|
+
"name": url[2].get("handle_name", "暂无")[:30] if len(url) > 2 else "暂无",
|
|
70
|
+
"method": url[2].get("method", []) if len(url) > 2 else [],
|
|
71
|
+
"status": url[2].get("handle_status", "y")[:2] if len(url) > 2 else "y",
|
|
72
|
+
}
|
|
73
|
+
urls_meta_list.append(meta)
|
|
66
74
|
|
|
67
75
|
|
|
68
|
-
class MetaProbe(RequestHandler):
|
|
76
|
+
class MetaProbe(ABC, RequestHandler):
|
|
69
77
|
def head(self, *args, **kwargs):
|
|
70
|
-
self.
|
|
78
|
+
self._write_response()
|
|
71
79
|
|
|
72
80
|
def get(self, *args, **kwargs):
|
|
73
|
-
self.
|
|
81
|
+
self._write_response()
|
|
82
|
+
|
|
83
|
+
def _write_response(self):
|
|
84
|
+
self.write({
|
|
85
|
+
"code": 0,
|
|
86
|
+
"msg": "Get success",
|
|
87
|
+
"count": len(urls_meta_list),
|
|
88
|
+
"data": urls_meta_list,
|
|
89
|
+
})
|
|
74
90
|
|
|
75
91
|
|
|
76
92
|
if __name__ == '__main__':
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|