cloudoll 2.2.10__tar.gz → 2.2.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.
- {cloudoll-2.2.10 → cloudoll-2.2.11}/PKG-INFO +1 -1
- cloudoll-2.2.11/cloudoll/__init__.py +1 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/cli.py +17 -7
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/mail/smtp.py +2 -2
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/__init__.py +1 -1
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/base.py +1 -1
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/mysql.py +2 -2
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/robot/dingtalk.py +8 -8
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/robot/feishu.py +6 -6
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/utils/watch.py +3 -1
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/web/__init__.py +4 -4
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll.egg-info/PKG-INFO +1 -1
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll.egg-info/requires.txt +1 -1
- {cloudoll-2.2.10 → cloudoll-2.2.11}/setup.py +2 -1
- cloudoll-2.2.10/cloudoll/__init__.py +0 -1
- {cloudoll-2.2.10 → cloudoll-2.2.11}/LICENSE +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/README.md +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/__main__.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/error/__init__.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/error/errors.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/logging/__init__.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/mail/__init__.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/err.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/field.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/model.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/parse.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/orm/postgres.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/robot/__init__.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/robot/slack.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/utils/__init__.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/utils/common.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/utils/m2d.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/utils/patch_loop.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/web/exception.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/web/html.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/web/http.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/web/jwt.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll/web/settings.py +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll.egg-info/SOURCES.txt +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll.egg-info/dependency_links.txt +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll.egg-info/entry_points.txt +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/cloudoll.egg-info/top_level.txt +0 -0
- {cloudoll-2.2.10 → cloudoll-2.2.11}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.11"
|
|
@@ -76,23 +76,31 @@ def gen(path, create, table, environment, database) -> None:
|
|
|
76
76
|
|
|
77
77
|
@cli.command()
|
|
78
78
|
@click.option("-env", "--environment", help="Environment, local / test / prod", default="local")
|
|
79
|
-
@click.option("-p", "--port", help="Server's port", default=
|
|
80
|
-
@click.option("-h", "--host", help="Server's host", default=
|
|
79
|
+
@click.option("-p", "--port", help="Server's port", default=9001)
|
|
80
|
+
@click.option("-h", "--host", help="Server's host", default='0.0.0.0')
|
|
81
|
+
@click.option("-m", "--mode", help="development or production mode", default='development')
|
|
81
82
|
@click.option("-path", "--path",help="Unix file system path to serve on. Specifying a path will cause hostname and port arguments to be ignored.",)
|
|
82
|
-
@click.option("-
|
|
83
|
-
def start(environment, host, port, path,
|
|
83
|
+
@click.option("-e", "--entry", help="Entry point model name. delfault name app", default="app")
|
|
84
|
+
def start(environment, host, port, mode, path, entry) -> None:
|
|
84
85
|
"""Start a services."""
|
|
85
86
|
try:
|
|
87
|
+
print_info("Current mode: " ,mode)
|
|
88
|
+
config = get_config(environment)
|
|
89
|
+
# print(environment, host, port, mode, path, entry)
|
|
90
|
+
# return
|
|
91
|
+
if mode == 'production':
|
|
92
|
+
App = app.create(config=config)
|
|
93
|
+
App.run()
|
|
94
|
+
return
|
|
86
95
|
aux_app = web.Application(
|
|
87
96
|
logger=None,
|
|
88
97
|
)
|
|
89
|
-
config = get_config(environment)
|
|
90
98
|
server = config.get("server", {})
|
|
91
99
|
server = chainMap(server, {"host": host, "port": port, "path": path})
|
|
92
100
|
config["server"] = server
|
|
93
101
|
|
|
94
102
|
aux_port = int(server.port) + 1
|
|
95
|
-
task = AppTask(Path(".").resolve(), config, entry=
|
|
103
|
+
task = AppTask(Path(".").resolve(), config, entry=entry)
|
|
96
104
|
aux_app.cleanup_ctx.append(task.cleanup_ctx)
|
|
97
105
|
web.run_app(
|
|
98
106
|
aux_app,
|
|
@@ -102,8 +110,10 @@ def start(environment, host, port, path, model) -> None:
|
|
|
102
110
|
print=None,
|
|
103
111
|
shutdown_timeout=0.1,
|
|
104
112
|
)
|
|
113
|
+
except KeyboardInterrupt:
|
|
114
|
+
sys.exit(0)
|
|
105
115
|
except Exception as e:
|
|
106
|
-
#
|
|
116
|
+
# print_error(e)
|
|
107
117
|
print_error(traceback.format_exc())
|
|
108
118
|
sys.exit(0)
|
|
109
119
|
|
|
@@ -107,7 +107,7 @@ class Client(object):
|
|
|
107
107
|
self._server.sendmail(self._account, to_addr, msg.as_string())
|
|
108
108
|
self._server.quit()
|
|
109
109
|
except BaseException as er:
|
|
110
|
-
|
|
110
|
+
print_error(er)
|
|
111
111
|
|
|
112
112
|
def add_to_addr(self, nick, addr):
|
|
113
113
|
"""
|
|
@@ -139,7 +139,7 @@ class Client(object):
|
|
|
139
139
|
if len(mime_types) > 0:
|
|
140
140
|
mime_type = mime_types[0]
|
|
141
141
|
else:
|
|
142
|
-
|
|
142
|
+
print_error("无法匹配附件类型,可以尝试安装httpd服务")
|
|
143
143
|
## 这里如果拿不到type 需要安装httpd ,dnf install httpd
|
|
144
144
|
[t, n] = mime_type.split("/")
|
|
145
145
|
filename = os.path.basename(filepath) # 'a.txt'
|
|
@@ -110,7 +110,7 @@ class Postgres(MeteBase):
|
|
|
110
110
|
)
|
|
111
111
|
print_info(f"Database connection successfuly for postgres/{kw.get('db')}")
|
|
112
112
|
except Exception as e:
|
|
113
|
-
#
|
|
113
|
+
# print_error(e)
|
|
114
114
|
# print(traceback.format_exc())
|
|
115
115
|
print_error(
|
|
116
116
|
f"Database connection failed,the instance : postgres/{kw.get('db')}"
|
|
@@ -30,7 +30,7 @@ from aiomysql.pool import Pool
|
|
|
30
30
|
|
|
31
31
|
# from aiomysql.cursors import Cursor
|
|
32
32
|
# from aiomysql.connection import Connection
|
|
33
|
-
from cloudoll.logging import
|
|
33
|
+
from cloudoll.logging import print_error
|
|
34
34
|
|
|
35
35
|
# from inspect import isclass, isfunction
|
|
36
36
|
from .base import MeteBase
|
|
@@ -79,5 +79,5 @@ class Mysql(MeteBase):
|
|
|
79
79
|
loop=loop,
|
|
80
80
|
)
|
|
81
81
|
except Exception as e:
|
|
82
|
-
|
|
82
|
+
print_error(f"Database connection failed,the instance : {kw.get('db')}")
|
|
83
83
|
return self
|
|
@@ -7,7 +7,7 @@ __author__ = "chuchur/chuchur.com"
|
|
|
7
7
|
import base64
|
|
8
8
|
import hashlib
|
|
9
9
|
import hmac
|
|
10
|
-
import
|
|
10
|
+
from ..logging import print_error
|
|
11
11
|
from curl_cffi import requests as http
|
|
12
12
|
import time
|
|
13
13
|
from urllib import parse
|
|
@@ -22,7 +22,7 @@ class Client(object):
|
|
|
22
22
|
def _get_sign(self):
|
|
23
23
|
secret = self._secret
|
|
24
24
|
if not secret:
|
|
25
|
-
|
|
25
|
+
print_error("缺少secret")
|
|
26
26
|
return None, None
|
|
27
27
|
|
|
28
28
|
# 拼接timestamp和secret
|
|
@@ -48,7 +48,7 @@ class Client(object):
|
|
|
48
48
|
"""
|
|
49
49
|
access_token = self._access_token
|
|
50
50
|
if not access_token:
|
|
51
|
-
|
|
51
|
+
print_error("请配置access_token")
|
|
52
52
|
return False
|
|
53
53
|
url = "https://oapi.dingtalk.com/media/upload?access_token=%s" % access_token
|
|
54
54
|
with open(filepath, "rb") as f:
|
|
@@ -58,7 +58,7 @@ class Client(object):
|
|
|
58
58
|
if res["errcode"] == 0:
|
|
59
59
|
return res
|
|
60
60
|
else:
|
|
61
|
-
|
|
61
|
+
print_error(res["errmsg"])
|
|
62
62
|
|
|
63
63
|
def send(self, data: dict):
|
|
64
64
|
"""
|
|
@@ -67,7 +67,7 @@ class Client(object):
|
|
|
67
67
|
"""
|
|
68
68
|
webhook = self._webhook
|
|
69
69
|
if not webhook:
|
|
70
|
-
|
|
70
|
+
print_error("缺少webhook")
|
|
71
71
|
return False
|
|
72
72
|
timestamp, sign = self._get_sign()
|
|
73
73
|
if not timestamp or not sign:
|
|
@@ -82,11 +82,11 @@ class Client(object):
|
|
|
82
82
|
if result:
|
|
83
83
|
res = result.json()
|
|
84
84
|
if res["errcode"] == 0:
|
|
85
|
-
|
|
85
|
+
print_error("发送成功!")
|
|
86
86
|
return True
|
|
87
87
|
else:
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
print_error("发送失败")
|
|
89
|
+
print_error(res["errmsg"])
|
|
90
90
|
return False
|
|
91
91
|
|
|
92
92
|
def send_text(self, text: str):
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
__author__ = "chuchur/chuchur.com"
|
|
5
5
|
|
|
6
|
-
import hashlib, hmac, time, base64
|
|
6
|
+
import hashlib, hmac, time, base64
|
|
7
7
|
from curl_cffi import requests as http
|
|
8
|
-
|
|
8
|
+
from ..logging import print_error,print_info
|
|
9
9
|
|
|
10
10
|
class Client(object):
|
|
11
11
|
def __init__(self, **kw):
|
|
@@ -15,7 +15,7 @@ class Client(object):
|
|
|
15
15
|
def _get_sign(self):
|
|
16
16
|
secret = self._secret
|
|
17
17
|
if not secret:
|
|
18
|
-
|
|
18
|
+
print_error("缺少secret")
|
|
19
19
|
return None, None
|
|
20
20
|
# 拼接timestamp和secret
|
|
21
21
|
timestamp = int(time.time())
|
|
@@ -36,7 +36,7 @@ class Client(object):
|
|
|
36
36
|
"""
|
|
37
37
|
webhook = self._webhook
|
|
38
38
|
if not webhook:
|
|
39
|
-
|
|
39
|
+
print_error("缺少webhook")
|
|
40
40
|
return False
|
|
41
41
|
timestamp, sign = self._get_sign()
|
|
42
42
|
if not timestamp or not sign:
|
|
@@ -48,10 +48,10 @@ class Client(object):
|
|
|
48
48
|
if result:
|
|
49
49
|
res = result.json()
|
|
50
50
|
if res["StatusCode"] == 0:
|
|
51
|
-
|
|
51
|
+
print_info("发送成功")
|
|
52
52
|
return False
|
|
53
53
|
else:
|
|
54
|
-
|
|
54
|
+
print_error("发送失败!")
|
|
55
55
|
return True
|
|
56
56
|
|
|
57
57
|
def send_text(self, text: str):
|
|
@@ -139,7 +139,9 @@ class AppTask(WatchTask):
|
|
|
139
139
|
def _start_dev_server(self) -> None:
|
|
140
140
|
act = "Start" if self._reloads == 0 else "Restart"
|
|
141
141
|
print_info(f"{act}ing dev server")
|
|
142
|
-
print_info(
|
|
142
|
+
print_info(
|
|
143
|
+
f"Server Running on http://{self._config['server']['host']}:{self._config['server']['port']}"
|
|
144
|
+
)
|
|
143
145
|
|
|
144
146
|
try:
|
|
145
147
|
tty_path = os.ttyname(sys.stdin.fileno())
|
|
@@ -125,7 +125,7 @@ def _get_modules(fd):
|
|
|
125
125
|
modules = set()
|
|
126
126
|
temp = os.path.join(os.path.abspath("."), fd)
|
|
127
127
|
if not os.path.exists(temp):
|
|
128
|
-
|
|
128
|
+
print_info("Routers not detected")
|
|
129
129
|
return modules
|
|
130
130
|
s = find_packages(temp)
|
|
131
131
|
for pkg in s:
|
|
@@ -170,7 +170,7 @@ def _reg_middleware():
|
|
|
170
170
|
mid_dir = os.path.join(os.path.abspath("."), root)
|
|
171
171
|
# print(mid_dir)
|
|
172
172
|
if not os.path.exists(mid_dir):
|
|
173
|
-
|
|
173
|
+
print_info("Middlewares not detected")
|
|
174
174
|
return
|
|
175
175
|
for f in os.listdir(mid_dir):
|
|
176
176
|
if not f.startswith("__"):
|
|
@@ -387,7 +387,7 @@ class Application(object):
|
|
|
387
387
|
:params prot default 9001
|
|
388
388
|
:params host default 127.0.0.1
|
|
389
389
|
"""
|
|
390
|
-
defaults = {"host": "
|
|
390
|
+
defaults = {"host": "0.0.0.0", "port": 9001, "path": None}
|
|
391
391
|
conf = self.config.get("server", {})
|
|
392
392
|
# args_conf = {"host": self.args.host, "port": self.args.port}
|
|
393
393
|
# print(conf)
|
|
@@ -409,7 +409,7 @@ class Application(object):
|
|
|
409
409
|
# if self.loop is None:
|
|
410
410
|
# return web.run_app(self.app, host=host, port=port, **kw)
|
|
411
411
|
# else:
|
|
412
|
-
#
|
|
412
|
+
# print_info(f"Server run at http://{host}:{port}")
|
|
413
413
|
# return self.loop.create_server(
|
|
414
414
|
# self.app.make_handler(), host=host, port=port, **kw
|
|
415
415
|
# )
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.10"
|
|
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
|