gomyck-tools 1.5.3__py3-none-any.whl → 1.5.4__py3-none-any.whl
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.
- ctools/database/database.py +27 -9
- ctools/stream/ckafka.py +2 -2
- ctools/web/bottle_webserver.py +7 -5
- {gomyck_tools-1.5.3.dist-info → gomyck_tools-1.5.4.dist-info}/METADATA +13 -12
- {gomyck_tools-1.5.3.dist-info → gomyck_tools-1.5.4.dist-info}/RECORD +8 -8
- {gomyck_tools-1.5.3.dist-info → gomyck_tools-1.5.4.dist-info}/WHEEL +0 -0
- {gomyck_tools-1.5.3.dist-info → gomyck_tools-1.5.4.dist-info}/licenses/LICENSE +0 -0
- {gomyck_tools-1.5.3.dist-info → gomyck_tools-1.5.4.dist-info}/top_level.txt +0 -0
ctools/database/database.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import contextlib
|
|
2
2
|
import datetime
|
|
3
3
|
import math
|
|
4
|
-
import threading
|
|
5
4
|
|
|
6
|
-
from sqlalchemy import create_engine, BigInteger, Column
|
|
7
|
-
from sqlalchemy.
|
|
8
|
-
from sqlalchemy.orm import sessionmaker, Session
|
|
5
|
+
from sqlalchemy import create_engine, BigInteger, Column
|
|
6
|
+
from sqlalchemy.orm import sessionmaker, Session, declarative_base
|
|
9
7
|
from sqlalchemy.sql import text
|
|
10
8
|
|
|
11
9
|
from ctools import call
|
|
@@ -14,17 +12,37 @@ from ctools.pools.thread_pool import thread_local
|
|
|
14
12
|
from ctools.web.bottle_web_base import PageInfo
|
|
15
13
|
|
|
16
14
|
"""
|
|
15
|
+
from time import sleep
|
|
16
|
+
|
|
17
|
+
from sqlalchemy import text, Column, BigInteger, String
|
|
18
|
+
|
|
19
|
+
from ctools import cid, cjson
|
|
20
|
+
from ctools.database import database
|
|
21
|
+
from ctools.database.database import BaseMixin
|
|
22
|
+
|
|
17
23
|
class XXXX(BaseMixin):
|
|
18
24
|
__tablename__ = 't_xxx_info'
|
|
19
25
|
__table_args__ = {'comment': 'xxx信息表'}
|
|
20
26
|
server_content: Column = Column(String(50), nullable=True, default='', comment='123123')
|
|
21
27
|
server_ip: Column = Column(String(30), index=True)
|
|
22
28
|
user_id: Column = Column(BigInteger)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
with database.get_session('source') as s:
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
database.init_db('postgresql://postgres:Hylink2014%40postgres@192.168.3.127:31199/postgres', default_schema='public', db_key='source', pool_size=100, auto_gen_table=True)
|
|
30
|
+
while True:
|
|
31
|
+
with database.get_session('source') as s:
|
|
32
|
+
params = {
|
|
33
|
+
'obj_id': cid.get_snowflake_id(),
|
|
34
|
+
'server_ip': cid.get_random_str(5),
|
|
35
|
+
'user_id': 123,
|
|
36
|
+
'server_content': cid.get_random_str(5),
|
|
37
|
+
}
|
|
38
|
+
s.execute(text('insert into t_xxx_info (obj_id, server_ip, user_id) values (:obj_id, :server_ip, :user_id)'), params)
|
|
39
|
+
s.commit()
|
|
40
|
+
sleep(0.2)
|
|
41
|
+
res = s.query(XXXX.obj_id, XXXX.server_ip, XXXX.user_id).all()
|
|
42
|
+
for item in res:
|
|
43
|
+
print(item._asdict())
|
|
44
|
+
print(len(res))
|
|
45
|
+
sleep(1)
|
|
28
46
|
"""
|
|
29
47
|
|
|
30
48
|
Base = None
|
ctools/stream/ckafka.py
CHANGED
|
@@ -15,7 +15,7 @@ from ctools.cjson import dumps
|
|
|
15
15
|
import time
|
|
16
16
|
from datetime import datetime
|
|
17
17
|
|
|
18
|
-
from ctools import thread_pool,
|
|
18
|
+
from ctools import thread_pool, cid
|
|
19
19
|
from ctools.ckafka import CKafka
|
|
20
20
|
|
|
21
21
|
c = CKafka(kafka_url='192.168.3.160:9094', secure=True)
|
|
@@ -27,7 +27,7 @@ def send_msg():
|
|
|
27
27
|
while True:
|
|
28
28
|
command = input('发送消息: Y/n \n')
|
|
29
29
|
if command.strip() not in ['N', 'n']:
|
|
30
|
-
producer.send_msg('jqxx', '{{"jqid": "{}", "xxxx": "{}"}}'.format(
|
|
30
|
+
producer.send_msg('jqxx', '{{"jqid": "{}", "xxxx": "{}"}}'.format(cid.get_snowflake_id(), datetime.strftime(datetime.now(), '%Y-%m-%d %H:%M:%S')))
|
|
31
31
|
else:
|
|
32
32
|
break
|
|
33
33
|
|
ctools/web/bottle_webserver.py
CHANGED
|
@@ -41,7 +41,6 @@ if __name__ == '__main__':
|
|
|
41
41
|
|
|
42
42
|
_default_port = 8888
|
|
43
43
|
|
|
44
|
-
|
|
45
44
|
class CBottle:
|
|
46
45
|
|
|
47
46
|
def __init__(self, bottle: Bottle, port=_default_port, quiet=False):
|
|
@@ -56,6 +55,7 @@ class CBottle:
|
|
|
56
55
|
self.static_root = './static'
|
|
57
56
|
self.download_root = './download'
|
|
58
57
|
self.template_root = './templates'
|
|
58
|
+
self.server_path = '/api/'
|
|
59
59
|
|
|
60
60
|
@self.bottle.route(['/', '/index'])
|
|
61
61
|
def index():
|
|
@@ -127,26 +127,28 @@ class CBottle:
|
|
|
127
127
|
def enable_spa_mode(self):
|
|
128
128
|
@self.bottle.error(404)
|
|
129
129
|
def error_404_handler(error):
|
|
130
|
-
if request.path.startswith(
|
|
130
|
+
if request.path.startswith(self.server_path):
|
|
131
131
|
response.status = 404
|
|
132
132
|
return R.error(resp=R.Code.cus_code(404, "资源未找到: {}".format(error.body)))
|
|
133
133
|
return static_file(filename=self.index_filename, root=self.index_root)
|
|
134
134
|
|
|
135
135
|
@self.bottle.error(401)
|
|
136
136
|
def unauthorized(error):
|
|
137
|
-
if request.path.startswith(
|
|
137
|
+
if request.path.startswith(self.server_path):
|
|
138
138
|
response.status = 401
|
|
139
139
|
return R.error(resp=R.Code.cus_code(401, "系统未授权! {}".format(error.body)))
|
|
140
140
|
response.status=301
|
|
141
141
|
response.set_header('Location', urljoin(request.url, '/'))
|
|
142
142
|
return response
|
|
143
143
|
|
|
144
|
-
def set_index(self, filename='index.html', root='./', is_tpl=False, redirect_url=None, spa=False, **kwargs):
|
|
144
|
+
def set_index(self, filename='index.html', root='./', is_tpl=False, redirect_url=None, spa=False, server_path="/api/", **kwargs):
|
|
145
145
|
self.index_root = root
|
|
146
146
|
self.index_filename = filename
|
|
147
147
|
self.is_tpl = is_tpl
|
|
148
148
|
self.redirect_url = redirect_url
|
|
149
|
-
if spa:
|
|
149
|
+
if spa:
|
|
150
|
+
self.server_path = server_path
|
|
151
|
+
self.enable_spa_mode()
|
|
150
152
|
self.tmp_args = kwargs
|
|
151
153
|
|
|
152
154
|
def set_static(self, root='./static'):
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gomyck-tools
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.4
|
|
4
4
|
Summary: A tools collection for python development by hao474798383
|
|
5
5
|
Author-email: gomyck <hao474798383@163.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
7
|
Requires-Python: >=3.11
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
|
-
Requires-Dist: jsonpickle~=
|
|
11
|
-
Requires-Dist: SQLAlchemy~=2.0.
|
|
10
|
+
Requires-Dist: jsonpickle~=4.1.1
|
|
11
|
+
Requires-Dist: SQLAlchemy~=2.0.44
|
|
12
12
|
Requires-Dist: chardet~=5.2.0
|
|
13
|
-
Requires-Dist: psycopg2-binary~=2.9.
|
|
13
|
+
Requires-Dist: psycopg2-binary~=2.9.11
|
|
14
14
|
Requires-Dist: croniter~=5.0.1
|
|
15
15
|
Requires-Dist: gmssl~=3.2.2
|
|
16
16
|
Requires-Dist: psutil~=6.1.0
|
|
@@ -18,27 +18,28 @@ Requires-Dist: jsonpath_ng~=1.7.0
|
|
|
18
18
|
Requires-Dist: bottle~=0.13.4
|
|
19
19
|
Requires-Dist: requests~=2.32.3
|
|
20
20
|
Requires-Dist: urllib3~=1.26.20
|
|
21
|
-
Requires-Dist: kafka-python~=2.0
|
|
21
|
+
Requires-Dist: kafka-python~=2.3.0
|
|
22
22
|
Requires-Dist: bs4~=0.0.2
|
|
23
23
|
Requires-Dist: paho-mqtt~=2.1.0
|
|
24
24
|
Requires-Dist: fuzzywuzzy~=0.18.0
|
|
25
25
|
Requires-Dist: pymysql~=1.1.1
|
|
26
26
|
Requires-Dist: pyzipper==0.3.6
|
|
27
|
-
Requires-Dist: prometheus_client==0.
|
|
27
|
+
Requires-Dist: prometheus_client==0.23.1
|
|
28
28
|
Requires-Dist: paramiko==3.5.0
|
|
29
29
|
Requires-Dist: pyjwt==2.10.1
|
|
30
|
-
Requires-Dist: cryptography==
|
|
31
|
-
Requires-Dist: redis==
|
|
32
|
-
Requires-Dist: uvloop>=0.
|
|
33
|
-
Requires-Dist: pyyaml>=6.0.
|
|
30
|
+
Requires-Dist: cryptography==46.0.3
|
|
31
|
+
Requires-Dist: redis==7.1.0
|
|
32
|
+
Requires-Dist: uvloop>=0.22.1
|
|
33
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
34
|
+
Requires-Dist: uiautomation>=2.0.20
|
|
34
35
|
Provides-Extra: kwc
|
|
35
36
|
Requires-Dist: imageio>=2.37.0; extra == "kwc"
|
|
36
37
|
Requires-Dist: wordcloud>=1.9.4; extra == "kwc"
|
|
37
38
|
Requires-Dist: jieba==0.42.1; extra == "kwc"
|
|
38
|
-
Requires-Dist: paddlepaddle==2.
|
|
39
|
+
Requires-Dist: paddlepaddle==3.2.2; extra == "kwc"
|
|
39
40
|
Provides-Extra: cut
|
|
40
41
|
Requires-Dist: jieba==0.42.1; extra == "cut"
|
|
41
|
-
Requires-Dist: paddlepaddle==2.
|
|
42
|
+
Requires-Dist: paddlepaddle==3.2.2; extra == "cut"
|
|
42
43
|
Provides-Extra: ml
|
|
43
44
|
Requires-Dist: scikit-learn>=1.7.1; extra == "ml"
|
|
44
45
|
Requires-Dist: pandas>=2.3.2; extra == "ml"
|
|
@@ -43,7 +43,7 @@ ctools/cipher/rsa.py,sha256=7TPwlt-JQxDVHwvL_Am9ZKI70B2CfJDqQDf473edHSQ,2264
|
|
|
43
43
|
ctools/cipher/sign.py,sha256=i__5PVevvR2-VjJyInmyH1QJOpmuxcA9ZIM0oxxFWVo,567
|
|
44
44
|
ctools/cipher/sm_util.py,sha256=cC58wZ9IL08SvUfWUNjX5139fal2SnXGaFQ0R9WA3SE,1675
|
|
45
45
|
ctools/database/__init__.py,sha256=fB36UC93Pya_1YyWGMzDy3D4tMDTBQoYK20E4wgNqec,98
|
|
46
|
-
ctools/database/database.py,sha256=
|
|
46
|
+
ctools/database/database.py,sha256=IQzPw2fOJh0Xn_OdSMeEOXBEV9YCRDoszg-dwJPXTTU,7765
|
|
47
47
|
ctools/geo/__init__.py,sha256=OkUaZv5ckkXJFNbRyFZqkX5m3GxTueEGEBU99_jJQNE,98
|
|
48
48
|
ctools/geo/coord_trans.py,sha256=UWCU1wnrTDU1aLSVAwmiHOeH7Pu-Dp8lDLAngDG48NM,3761
|
|
49
49
|
ctools/geo/douglas_rarefy.py,sha256=bJo6TwNxPa-7-8MOi8MULxeqnz4cvIJN-oXqBDWNAVM,4883
|
|
@@ -57,7 +57,7 @@ ctools/pools/__init__.py,sha256=3_W3mvEs6pInRTvK7TqOPu9dC2z8rCHvHZFXO4KNYT8,98
|
|
|
57
57
|
ctools/pools/process_pool.py,sha256=p6Mrh59gXrL9wpQ1dS72-GKtX_lEoAFc4_PLrXjukPk,957
|
|
58
58
|
ctools/pools/thread_pool.py,sha256=ekfoxowyaKWUgevUgRbwee27IFJpqNoz-w27urlX_q8,948
|
|
59
59
|
ctools/stream/__init__.py,sha256=mf8vkbcJdYpvDslgXkkHOz6rKBzU1qfxi8xQGQ1A90w,98
|
|
60
|
-
ctools/stream/ckafka.py,sha256=
|
|
60
|
+
ctools/stream/ckafka.py,sha256=qjb8FX6YDKB_ZVcRpP4ZC5irzJ4FQXh6Ev17Rl6dKOc,5920
|
|
61
61
|
ctools/stream/credis.py,sha256=qxfkhtwHCvGN2eUAr9lpS42um02IXkcZTmiMXs0_Yfg,4551
|
|
62
62
|
ctools/stream/mqtt_utils.py,sha256=HOT8uFOXmgPFRvxcmBPXlOJuhekupleaYwB47lGVSpk,10718
|
|
63
63
|
ctools/util/__init__.py,sha256=jJLxgj-rdTVIo_czMcN83-HQI9yyBYy1L5gw8ZAbmyc,98
|
|
@@ -75,14 +75,14 @@ ctools/web/__init__.py,sha256=koSNYeKF5Z_xbp4Q2qbZ4ZP-3--1phbOYN9e4SJy_gk,98
|
|
|
75
75
|
ctools/web/aio_web_server.py,sha256=p46BOU3_m4Jb57yAACeedKjhlFc1YC0QJSUe2selBgA,5693
|
|
76
76
|
ctools/web/api_result.py,sha256=i1MjTnnlgkWl_q07xr-TLQeLYlXEh4DEclUFE414nSk,1568
|
|
77
77
|
ctools/web/bottle_web_base.py,sha256=iQZJtRQH3HJ-P-48Gspvp1VEd6boAlZfiat3H8E5bBU,8763
|
|
78
|
-
ctools/web/bottle_webserver.py,sha256=
|
|
78
|
+
ctools/web/bottle_webserver.py,sha256=9IcmQ8dHtbR7VW29sqZ_NM954KNf-V_Z6rJZ4pnz4P4,7169
|
|
79
79
|
ctools/web/bottle_websocket.py,sha256=xsu9fAtTuR5DsSsQjiBfaYxLjOWFyfr1sYM6cktTovI,1957
|
|
80
80
|
ctools/web/ctoken.py,sha256=WaB29kqGlKAh21aUw5avl2h8AgLD1aESw8KCpqaN5nM,2539
|
|
81
81
|
ctools/web/download_util.py,sha256=v0JTXiED1bvoWFfwfd-LD5s7_aoRQ0lCkaGwSnSp7WI,1954
|
|
82
82
|
ctools/web/params_util.py,sha256=eJDV3PSq-ZHb8UZf6xqs8kOhbyZzits1H9yPoUBIDXg,828
|
|
83
83
|
ctools/web/upload_util.py,sha256=z1QQCi4SFx08jrAQH5-Y_ShiM4MghuD_5Qz6V9KK_4U,1076
|
|
84
|
-
gomyck_tools-1.5.
|
|
85
|
-
gomyck_tools-1.5.
|
|
86
|
-
gomyck_tools-1.5.
|
|
87
|
-
gomyck_tools-1.5.
|
|
88
|
-
gomyck_tools-1.5.
|
|
84
|
+
gomyck_tools-1.5.4.dist-info/licenses/LICENSE,sha256=X25ypfH9E6VTht2hcO8k7LCSdHUcoG_ALQt80jdYZfY,547
|
|
85
|
+
gomyck_tools-1.5.4.dist-info/METADATA,sha256=byhNUGqMt6IFVmf5ROsxNuuK3ST4fjcPTKqZa8pzuC4,1862
|
|
86
|
+
gomyck_tools-1.5.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
87
|
+
gomyck_tools-1.5.4.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
|
|
88
|
+
gomyck_tools-1.5.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|