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.
Files changed (51) hide show
  1. {codosdk-1.0.11 → codosdk-1.0.13}/PKG-INFO +1 -1
  2. {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/PKG-INFO +1 -1
  3. {codosdk-1.0.11 → codosdk-1.0.13}/setup.py +1 -1
  4. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/application.py +33 -17
  5. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/crud_utils.py +1 -1
  6. {codosdk-1.0.11 → codosdk-1.0.13}/LICENSE +0 -0
  7. {codosdk-1.0.11 → codosdk-1.0.13}/README.md +0 -0
  8. {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/SOURCES.txt +0 -0
  9. {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/dependency_links.txt +0 -0
  10. {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/requires.txt +0 -0
  11. {codosdk-1.0.11 → codosdk-1.0.13}/codosdk.egg-info/top_level.txt +0 -0
  12. {codosdk-1.0.11 → codosdk-1.0.13}/opssdk/__init__.py +0 -0
  13. {codosdk-1.0.11 → codosdk-1.0.13}/opssdk/utils/__init__.py +0 -0
  14. {codosdk-1.0.11 → codosdk-1.0.13}/pyproject.toml +0 -0
  15. {codosdk-1.0.11 → codosdk-1.0.13}/setup.cfg +0 -0
  16. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/__init__.py +0 -0
  17. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/api_set.py +0 -0
  18. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/__init__.py +0 -0
  19. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/admin_apis.py +0 -0
  20. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/agent_apis.py +0 -0
  21. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/cmdb_apis.py +0 -0
  22. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/kerrigan_apis.py +0 -0
  23. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/mgv4_apis.py +0 -0
  24. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/apis/task_apis.py +0 -0
  25. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/base_handler.py +0 -0
  26. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cache.py +0 -0
  27. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cache_context.py +0 -0
  28. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/client.py +0 -0
  29. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud/__init__.py +0 -0
  30. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud/qcloud_api.py +0 -0
  31. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud/ucloud_api.py +0 -0
  32. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/cloud_utils.py +0 -0
  33. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/configs.py +0 -0
  34. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/consts.py +0 -0
  35. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/db_context.py +0 -0
  36. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/error.py +0 -0
  37. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/fetch_coroutine.py +0 -0
  38. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/jwt_token.py +0 -0
  39. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/ldap.py +0 -0
  40. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/logger.py +0 -0
  41. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/model_utils.py +0 -0
  42. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/mqhelper.py +0 -0
  43. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/program.py +0 -0
  44. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/salt_api.py +0 -0
  45. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/sqlalchemy_pagination.py +0 -0
  46. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/tools.py +0 -0
  47. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/__init__.py +0 -0
  48. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/cc_crypto.py +0 -0
  49. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/date_format.py +0 -0
  50. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/utils/pydantic_utils.py +0 -0
  51. {codosdk-1.0.11 → codosdk-1.0.13}/websdk2/web_logs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: codosdk
3
- Version: 1.0.11
3
+ Version: 1.0.13
4
4
  Summary: CODO项目的Python SDK
5
5
  Home-page: https://github.com/ss1917/codo_sdk/
6
6
  Author: shenshuo
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: codosdk
3
- Version: 1.0.11
3
+ Version: 1.0.13
4
4
  Summary: CODO项目的Python SDK
5
5
  Home-page: https://github.com/ss1917/codo_sdk/
6
6
  Author: shenshuo
@@ -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.11'
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
- if configs.can_import: configs.import_dict(**settings)
34
- # ins_log.read_log('info', '%s' % options.progid)
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
- self.urls_meta_handle(handlers)
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
- except:
56
- import traceback
57
- logging.error('%(tra)s' % dict(tra=traceback.format_exc()))
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
- def urls_meta_handle(self, urls):
60
- # 数据写入内存,启动的时候上报至权限管理
61
- urls_meta_list.extend([{"url": u[0], "name": u[2].get('handle_name')[0:30] if u[2].get('handle_name') else "",
62
- "method": u[2].get('method') if u[2].get('method') and len(
63
- u[2].get('method')) < 100 else [],
64
- "status": u[2].get('handle_status')[0:2] if u[2].get('handle_status') else "y"} if len(
65
- u) > 2 else {"url": u[0], "name": "暂无", "status": "y"} for u in urls])
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.write(dict(code=0, msg="Get success", count=len(urls_meta_list), data=urls_meta_list))
78
+ self._write_response()
71
79
 
72
80
  def get(self, *args, **kwargs):
73
- self.write(dict(code=0, msg="Get success", count=len(urls_meta_list), data=urls_meta_list))
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__':
@@ -41,7 +41,7 @@ class ModelCRUDView:
41
41
  if not _info:
42
42
  return dict(code=1, msg='数据未找到', data=None)
43
43
  return dict(code=0, msg='获取成功', data={
44
- data: _info.to_dict()
44
+ 'item': _info.to_dict()
45
45
  })
46
46
  except Exception as e:
47
47
  logging.error(f"Database query failed: {e}")
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