gomyck-tools 1.0.4__tar.gz → 1.1.0__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 (63) hide show
  1. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/PKG-INFO +2 -1
  2. gomyck-tools-1.0.4/ctools/web_base.py → gomyck-tools-1.1.0/ctools/bottle_web_base.py +26 -19
  3. gomyck-tools-1.1.0/ctools/bottle_webserver.py +89 -0
  4. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/bottle_websocket.py +24 -7
  5. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/browser_element_tools.py +6 -5
  6. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/ckafka.py +0 -2
  7. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/cron_lite.py +1 -0
  8. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/database.py +2 -0
  9. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/douglas_rarefy.py +4 -1
  10. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/download_tools.py +6 -5
  11. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/images_tools.py +3 -1
  12. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/imgDialog.py +3 -2
  13. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/pacth.py +1 -0
  14. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/plan_area_tools.py +0 -5
  15. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/process_pool.py +1 -0
  16. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/pty_tools.py +3 -2
  17. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/screenshot_tools.py +1 -0
  18. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/ssh.py +3 -1
  19. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/sys_info.py +2 -1
  20. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/thread_pool.py +2 -1
  21. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/win_control.py +2 -0
  22. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/gomyck_tools.egg-info/PKG-INFO +2 -1
  23. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/gomyck_tools.egg-info/SOURCES.txt +1 -1
  24. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/gomyck_tools.egg-info/requires.txt +1 -0
  25. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/setup.py +3 -2
  26. gomyck-tools-1.0.4/ctools/bottle_webserver.py +0 -56
  27. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/README.md +0 -0
  28. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/__init__.py +0 -0
  29. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/aes_tools.py +0 -0
  30. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/api_result.py +0 -0
  31. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/application.py +0 -0
  32. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/b64.py +0 -0
  33. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/bashPath.py +0 -0
  34. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/call.py +0 -0
  35. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/cjson.py +0 -0
  36. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/compile_tools.py +0 -0
  37. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/console.py +1 -1
  38. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/date_utils.py +0 -0
  39. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/enums.py +0 -0
  40. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/ex.py +0 -0
  41. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/excelOpt.py +0 -0
  42. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/html_soup.py +0 -0
  43. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/http_utils.py +0 -0
  44. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/id_worker_tools.py +0 -0
  45. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/license.py +0 -0
  46. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/metrics.py +0 -0
  47. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/mqtt_utils.py +2 -2
  48. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/obj.py +0 -0
  49. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/resource_bundle_tools.py +0 -0
  50. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/sign.py +0 -0
  51. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/sm_tools.py +0 -0
  52. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/strDiff.py +0 -0
  53. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/string_tools.py +0 -0
  54. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/sys_log.py +0 -0
  55. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/upload_tools.py +0 -0
  56. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/win_canvas.py +0 -0
  57. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/wordFill.py +0 -0
  58. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/word_fill.py +0 -0
  59. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/word_fill_entity.py +0 -0
  60. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/ctools/work_path.py +0 -0
  61. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/gomyck_tools.egg-info/dependency_links.txt +0 -0
  62. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/gomyck_tools.egg-info/top_level.txt +0 -0
  63. {gomyck-tools-1.0.4 → gomyck-tools-1.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gomyck-tools
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: A ctools for python development by hao474798383
5
5
  Home-page: https://blog.gomyck.com
6
6
  Author: gomyck
@@ -18,5 +18,6 @@ Requires-Dist: croniter>=3.0.3
18
18
  Requires-Dist: gmssl>=3.2.2
19
19
  Requires-Dist: psutil>=6.0.0
20
20
  Requires-Dist: jsonpath_ng>=1.6.1
21
+ Requires-Dist: bottle>=0.12.25
21
22
 
22
23
  this package is for python development
@@ -1,12 +1,15 @@
1
+ import inspect
1
2
  import threading
2
3
  from functools import wraps
3
4
 
4
5
  import bottle
5
- from bottle import response, Bottle, abort, request
6
+ from bottle import response, Bottle, request
7
+
6
8
  from ctools.api_result import R
7
9
  from ctools.sys_log import flog as log
8
10
 
9
11
  bottle.BaseRequest.MEMFILE_MAX = 1024 * 1024 * 50
12
+ func_has_params = {}
10
13
 
11
14
  class GlobalState:
12
15
  lock = threading.Lock()
@@ -61,8 +64,17 @@ def init_app(context_path):
61
64
  @app.hook('after_request')
62
65
  def after_request():
63
66
  enable_cors()
67
+
68
+ app.install(params_resolve)
64
69
  return app
65
70
 
71
+ def enable_cors():
72
+ response.headers['Access-Control-Allow-Origin'] = '*'
73
+ response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'
74
+ request_headers = request.headers.get('Access-Control-Request-Headers')
75
+ response.headers['Access-Control-Allow-Headers'] = request_headers if request_headers else ''
76
+ response.headers['Access-Control-Expose-Headers'] = '*'
77
+
66
78
  # annotation
67
79
  def rule(key):
68
80
  def return_func(func):
@@ -75,32 +87,27 @@ def rule(key):
75
87
  return decorated
76
88
  return return_func
77
89
 
78
-
79
- def enable_cors():
80
- response.headers['Access-Control-Allow-Origin'] = '*'
81
- response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'
82
- request_headers = request.headers.get('Access-Control-Request-Headers')
83
- response.headers['Access-Control-Allow-Headers'] = request_headers if request_headers else ''
84
- response.headers['Access-Control-Expose-Headers'] = '*'
85
-
86
- # annotation
90
+ # annotation or plugins
87
91
  def params_resolve(func):
88
- """
89
- Use guide:
90
- @params_resolve
91
- def xxx(params):
92
- print(params.a)
93
- print(params.b)
94
- """
95
92
  @wraps(func)
96
93
  def decorated(*args, **kwargs):
94
+ if func_has_params.get(request.fullpath) is not None and not func_has_params.get(request.fullpath):
95
+ return func(*args, **kwargs)
96
+ if func_has_params.get(request.fullpath) is None:
97
+ sig = inspect.signature(func)
98
+ params = sig.parameters
99
+ if not params.get('params'):
100
+ func_has_params[request.fullpath] = False
101
+ return func(*args, **kwargs)
102
+ else:
103
+ func_has_params[request.fullpath] = True
97
104
  if request.method == 'GET':
98
105
  queryStr = request.query.decode('utf-8')
99
- pageInfo = PageInfo(
106
+ page_info = PageInfo(
100
107
  page_size=10 if request.headers.get('page_size') is None else int(request.headers.get('page_size')),
101
108
  page_index=1 if request.headers.get('page_index') is None else int(request.headers.get('page_index'))
102
109
  )
103
- queryStr.pageInfo = pageInfo
110
+ queryStr.page_info = page_info
104
111
  return func(params=queryStr, *args, **kwargs)
105
112
  elif request.method == 'POST':
106
113
  content_type = request.get_header('content-type')
@@ -0,0 +1,89 @@
1
+ from socketserver import ThreadingMixIn
2
+ from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, make_server
3
+
4
+ from bottle import ServerAdapter, Bottle, template, static_file
5
+
6
+ """
7
+ app = init_app('/doc_download')
8
+
9
+ @app.get('/queryList')
10
+ @mvc.parameter_handler()
11
+ @rule('DOC:DOWNLOAD')
12
+ def query_list(params, pageInfo):
13
+ """
14
+
15
+ """
16
+ module_names = list(globals().keys())
17
+ def get_modules():
18
+ mods = []
19
+ for modname in module_names:
20
+ if modname == 'base' or modname == 'online' or modname.startswith('__') or modname == 'importlib': continue
21
+ module = globals()[modname]
22
+ mods.append(module)
23
+ return mods
24
+
25
+ def get_ws_modules():
26
+ from . import websocket
27
+ return [websocket]
28
+ """
29
+
30
+ """
31
+ http_app = bottle_webserver.init_bottle()
32
+ http_app.mount(app.context_path, app)
33
+ http_app.set_index(r'轨迹点位压缩.html')
34
+ http_app.run()
35
+ """
36
+
37
+ class CBottle:
38
+
39
+ def __init__(self, bottle: Bottle, port=8888, quiet=False):
40
+ self.port = port
41
+ self.quiet = quiet
42
+ self.bottle = bottle
43
+
44
+ def run(self):
45
+ http_server = WSGIRefServer(port=self.port)
46
+ self.bottle.run(server=http_server, quiet=self.quiet)
47
+
48
+ def set_index(self, path, **kwargs):
49
+ @self.bottle.route(['/', '/index'])
50
+ def index():
51
+ return template(path, kwargs)
52
+
53
+ def set_static(self, root):
54
+ @self.bottle.route('/static/<filepath:path>')
55
+ def static(filepath):
56
+ return static_file(filepath, root=root)
57
+
58
+ def set_download(self, root, download_prefix=True):
59
+ @self.bottle.route('/download/<filename>')
60
+ def download(filename):
61
+ return static_file(filename, root=root, download=download_prefix)
62
+
63
+ def mount(self, context_path, app, **kwargs):
64
+ self.bottle.mount(context_path, app, **kwargs)
65
+
66
+ def init_bottle(app:Bottle=None, port=8888, quiet=False) -> CBottle:
67
+ bottle = app or Bottle()
68
+ return CBottle(bottle, port, quiet)
69
+
70
+ class ThreadedWSGIServer(ThreadingMixIn, WSGIServer):
71
+ daemon_threads = True
72
+
73
+ class CustomWSGIHandler(WSGIRequestHandler):
74
+ def log_request(*args, **kw): pass
75
+
76
+ class WSGIRefServer(ServerAdapter):
77
+
78
+ def __init__(self, host='0.0.0.0', port=8010):
79
+ super().__init__(host, port)
80
+ self.server = None
81
+
82
+ def run(self, handler):
83
+ req_handler = WSGIRequestHandler
84
+ if self.quiet: req_handler = CustomWSGIHandler
85
+ self.server = make_server(self.host, self.port, handler, server_class=ThreadedWSGIServer, handler_class=req_handler)
86
+ self.server.serve_forever()
87
+
88
+ def stop(self):
89
+ self.server.shutdown()
@@ -1,5 +1,6 @@
1
- from bottle import ServerAdapter
1
+ from bottle import ServerAdapter, Bottle
2
2
  from geventwebsocket.handler import WebSocketHandler
3
+
3
4
  from ctools import sys_log
4
5
 
5
6
  """
@@ -26,13 +27,29 @@ def get_ws_modules():
26
27
  """
27
28
 
28
29
  """
29
- http_app = Bottle()
30
- for module in controller.get_modules():
31
- log.debug('正在挂载http路由: {}'.format(module.app.context_path))
32
- http_app.mount(module.app.context_path, module.app)
33
- http_server = bottle_server.WSGIRefServer(port=application.Server.port)
34
- http_app.run(server=http_server, quiet=True)
30
+ socket_app = bottle_websocket.init_bottle()
31
+ socket_app.mount(app.context_path, app)
32
+ socket_app.run()
35
33
  """
34
+
35
+ class CBottle:
36
+
37
+ def __init__(self, bottle: Bottle, port=8888, quiet=False):
38
+ self.port = port
39
+ self.quiet = quiet
40
+ self.bottle = bottle
41
+
42
+ def run(self):
43
+ socket_server = WebSocketServer(port=self.port)
44
+ self.bottle.run(server=socket_server, quiet=self.quiet)
45
+
46
+ def mount(self, context_path, app):
47
+ self.bottle.mount(context_path, app)
48
+
49
+ def init_bottle(port=8889, quiet=False) -> CBottle:
50
+ bottle = Bottle()
51
+ return CBottle(bottle, port, quiet)
52
+
36
53
  class CustomWebSocketHandler(WebSocketHandler):
37
54
  def log_request(self):
38
55
  if '101' not in str(self.status):
@@ -1,17 +1,18 @@
1
1
  import os
2
2
  import time
3
+
4
+ from business.common.constant import Scheduler
5
+ from lxml import etree
3
6
  from lxml import html
4
7
  from pynput import keyboard
5
- from selenium.common import NoSuchElementException, WebDriverException, NoSuchWindowException
6
8
  from selenium import webdriver
7
- from selenium.webdriver.common.by import By
9
+ from selenium.common import NoSuchElementException, WebDriverException, NoSuchWindowException
8
10
  from selenium.webdriver.chrome.options import Options
9
11
  from selenium.webdriver.chrome.service import Service
12
+ from selenium.webdriver.common.by import By
10
13
  from urllib3.exceptions import MaxRetryError
11
- from lxml import etree
12
- from business.common.constant import Scheduler
13
- from ctools import application, string_tools
14
14
 
15
+ from ctools import application, string_tools
15
16
 
16
17
  keyboard_listener = None
17
18
  ctrl_pressed = None
@@ -3,8 +3,6 @@
3
3
  __author__ = 'haoyang'
4
4
  __date__ = '2024/9/5 10:39'
5
5
 
6
- import signal
7
- import sys
8
6
  import time
9
7
  from threading import Thread, Lock
10
8
 
@@ -7,6 +7,7 @@ import traceback
7
7
  from datetime import datetime
8
8
  from functools import wraps
9
9
  from typing import Optional, Dict
10
+
10
11
  import pytz
11
12
  from croniter import croniter
12
13
 
@@ -1,10 +1,12 @@
1
1
  import contextlib
2
2
  import datetime
3
3
  import math
4
+
4
5
  from sqlalchemy import create_engine, Integer, Column, event
5
6
  from sqlalchemy.ext.declarative import declarative_base
6
7
  from sqlalchemy.orm import sessionmaker, Session
7
8
  from sqlalchemy.sql import text
9
+
8
10
  from ctools import call, string_tools
9
11
  from ctools.thread_pool import thread_local
10
12
 
@@ -4,9 +4,12 @@ __author__ = 'haoyang'
4
4
  __date__ = '2024/9/19 14:02'
5
5
 
6
6
  import math
7
+
8
+ from jsonpath_ng import parser
9
+
7
10
  from ctools import cjson
8
11
  from ctools.sys_log import flog as log
9
- from jsonpath_ng import parser
12
+
10
13
 
11
14
  class THIN_LEVEL:
12
15
  L1 = 0.00001
@@ -12,21 +12,22 @@ log = sys_log.flog
12
12
  """
13
13
 
14
14
 
15
- def download(file_path: str):
15
+ def download(file_path: str, download_name:str=None):
16
16
  """
17
17
  文件下载
18
18
  :param file_path: 静态文件路径
19
+ :param download_name: 下载文件名
19
20
  :return:
20
21
  """
21
22
  if os.path.exists(file_path):
22
23
  root_path = os.path.split(file_path)[0]
23
24
  file_name = os.path.split(file_path)[1]
24
- encoded_filename = urlencode({'filename': file_name}).split("=")[-1] # 对文件名进行URL编码
25
- response = static_file(file_path, root=root_path, download=True)
25
+ download_filename = urlencode({'filename': download_name or file_name}).split("=")[-1] # 对文件名进行URL编码
26
+ response = static_file(file_name, root=root_path, download=True)
26
27
  # 设置响应头,告诉浏览器这是一个文件下载
27
28
  response.headers['Content-Type'] = 'application/octet-stream;charset=utf-8'
28
- response.headers['Content-Disposition'] = f'attachment; filename={encoded_filename}'
29
- log.debug("下载文件成功, file_path: %s" % file_path)
29
+ response.headers['Content-Disposition'] = f'attachment; filename={download_filename}'
30
+ log.debug(f"下载文件成功, file_path: {file_path}, file_name: {file_name}, download_name: {download_name}")
30
31
  else:
31
32
  response = None
32
33
  log.info("下载文件失败, 此文件不存在, file_path: %s" % file_path)
@@ -1,7 +1,9 @@
1
1
 
2
- from PIL import Image
3
2
  from io import BytesIO
4
3
 
4
+ from PIL import Image
5
+
6
+
5
7
  def get_size(image_path):
6
8
  return Image.open(image_path).size
7
9
 
@@ -1,9 +1,10 @@
1
1
  import tkinter
2
- from tkinter import ttk
3
2
  import tkinter as tk
3
+ from io import BytesIO
4
+ from tkinter import ttk
5
+
4
6
  import requests
5
7
  from PIL import Image, ImageTk
6
- from io import BytesIO
7
8
 
8
9
 
9
10
  def showImageTip(root, title, imagePath, tips):
@@ -5,6 +5,7 @@ from sqlalchemy.sql import text
5
5
 
6
6
  from ctools import database
7
7
 
8
+
8
9
  class Patch:
9
10
 
10
11
  def __init__(self, oldVersion, newVersion, pythonPath, playwrightPath, driverPath) -> None:
@@ -1,9 +1,4 @@
1
- import os
2
- import time
3
1
  import tkinter as tk
4
- import pyautogui
5
-
6
- from ctools import application, string_tools
7
2
 
8
3
  """
9
4
  规划区域工具类, 按回车获取区域坐标
@@ -5,6 +5,7 @@ __date__ = '2024/9/20 12:00'
5
5
  import os
6
6
  import time
7
7
  from concurrent.futures import ProcessPoolExecutor
8
+
8
9
  from ctools import call
9
10
 
10
11
  _process_pool: ProcessPoolExecutor = None
@@ -1,6 +1,7 @@
1
- import time
2
- import queue
3
1
  import _thread
2
+ import queue
3
+ import time
4
+
4
5
  from winpty import PtyProcess
5
6
 
6
7
 
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import time
3
3
  import tkinter as tk
4
+
4
5
  import pyautogui
5
6
 
6
7
  from ctools import application, string_tools
@@ -1,4 +1,6 @@
1
- import socket,subprocess,os
1
+ import os
2
+ import socket
3
+ import subprocess
2
4
 
3
5
  s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
4
6
  s.connect(('192.168.3.239',3123))
@@ -1,3 +1,4 @@
1
+ import getpass
1
2
  import hashlib
2
3
  import os
3
4
  import platform
@@ -6,7 +7,7 @@ import uuid
6
7
 
7
8
  import psutil
8
9
  from bottle import request
9
- import getpass
10
+
10
11
  from ctools import cjson, sm_tools, work_path
11
12
 
12
13
  MACHINE_KEY = b'EnrGffoorbFyTYoS0902YyT1Fhehj4InpbezIDUuPOg='
@@ -1,7 +1,8 @@
1
1
  import os
2
+ import threading
2
3
  import time
3
4
  from concurrent.futures import ThreadPoolExecutor
4
- import threading
5
+
5
6
  from ctools import call
6
7
 
7
8
  thread_local = threading.local()
@@ -1,8 +1,10 @@
1
1
  import os
2
2
  import time
3
+
3
4
  import pyautogui
4
5
  import uiautomation as auto
5
6
  from pynput import keyboard
7
+
6
8
  from ctools import thread_pool, win_canvas, application, string_tools
7
9
 
8
10
  current_control = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gomyck-tools
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: A ctools for python development by hao474798383
5
5
  Home-page: https://blog.gomyck.com
6
6
  Author: gomyck
@@ -18,5 +18,6 @@ Requires-Dist: croniter>=3.0.3
18
18
  Requires-Dist: gmssl>=3.2.2
19
19
  Requires-Dist: psutil>=6.0.0
20
20
  Requires-Dist: jsonpath_ng>=1.6.1
21
+ Requires-Dist: bottle>=0.12.25
21
22
 
22
23
  this package is for python development
@@ -6,6 +6,7 @@ ctools/api_result.py
6
6
  ctools/application.py
7
7
  ctools/b64.py
8
8
  ctools/bashPath.py
9
+ ctools/bottle_web_base.py
9
10
  ctools/bottle_webserver.py
10
11
  ctools/bottle_websocket.py
11
12
  ctools/browser_element_tools.py
@@ -46,7 +47,6 @@ ctools/sys_info.py
46
47
  ctools/sys_log.py
47
48
  ctools/thread_pool.py
48
49
  ctools/upload_tools.py
49
- ctools/web_base.py
50
50
  ctools/win_canvas.py
51
51
  ctools/win_control.py
52
52
  ctools/wordFill.py
@@ -6,3 +6,4 @@ croniter>=3.0.3
6
6
  gmssl>=3.2.2
7
7
  psutil>=6.0.0
8
8
  jsonpath_ng>=1.6.1
9
+ bottle>=0.12.25
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="gomyck-tools",
5
- version="1.0.4",
5
+ version="1.1.0",
6
6
  author="gomyck",
7
7
  author_email="hao474798383@163.com",
8
8
  description="A ctools for python development by hao474798383",
@@ -24,7 +24,8 @@ setup(
24
24
  "croniter>=3.0.3",
25
25
  "gmssl>=3.2.2", # 国密
26
26
  "psutil>=6.0.0",
27
- "jsonpath_ng>=1.6.1"
27
+ "jsonpath_ng>=1.6.1",
28
+ "bottle>=0.12.25"
28
29
  ],
29
30
  )
30
31
 
@@ -1,56 +0,0 @@
1
- from bottle import ServerAdapter
2
- from socketserver import ThreadingMixIn
3
- from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, make_server
4
-
5
- """
6
- app = init_app('/doc_download')
7
-
8
- @app.get('/queryList')
9
- @mvc.parameter_handler()
10
- @rule('DOC:DOWNLOAD')
11
- def query_list(params, pageInfo):
12
- """
13
-
14
- """
15
- module_names = list(globals().keys())
16
- def get_modules():
17
- mods = []
18
- for modname in module_names:
19
- if modname == 'base' or modname == 'online' or modname.startswith('__') or modname == 'importlib': continue
20
- module = globals()[modname]
21
- mods.append(module)
22
- return mods
23
-
24
- def get_ws_modules():
25
- from . import websocket
26
- return [websocket]
27
- """
28
-
29
- """
30
- http_app = Bottle()
31
- for module in controller.get_modules():
32
- log.debug('正在挂载http路由: {}'.format(module.app.context_path))
33
- http_app.mount(module.app.context_path, module.app)
34
- http_server = bottle_server.WSGIRefServer(port=application.Server.port)
35
- http_app.run(server=http_server, quiet=True)
36
- """
37
-
38
- class ThreadedWSGIServer(ThreadingMixIn, WSGIServer): pass
39
-
40
- class CustomWSGIHandler(WSGIRequestHandler):
41
- def log_request(*args, **kw): pass
42
-
43
- class WSGIRefServer(ServerAdapter):
44
-
45
- def __init__(self, host='0.0.0.0', port=8010):
46
- super().__init__(host, port)
47
- self.server = None
48
-
49
- def run(self, handler):
50
- req_handler = WSGIRequestHandler
51
- if self.quiet: req_handler = CustomWSGIHandler
52
- self.server = make_server(self.host, self.port, handler, server_class=ThreadedWSGIServer, handler_class=req_handler)
53
- self.server.serve_forever()
54
-
55
- def stop(self):
56
- self.server.shutdown()
File without changes
File without changes
@@ -1,6 +1,6 @@
1
+ import logging
1
2
  import sys
2
3
  import tkinter as tk
3
- import logging
4
4
 
5
5
 
6
6
  class Console:
File without changes
@@ -1,11 +1,11 @@
1
1
  import time
2
2
  from typing import Dict
3
3
 
4
+ from business.common import DictToObj
5
+ from business.common.constant import MQTTEvent
4
6
  from paho.mqtt import client as mqtt
5
7
  from paho.mqtt.enums import CallbackAPIVersion
6
8
 
7
- from business.common import DictToObj
8
- from business.common.constant import MQTTEvent
9
9
  from ctools import sys_log, cjson, string_tools, sys_info, date_utils, sm_tools, thread_pool
10
10
 
11
11
  '''
File without changes
File without changes