gomyck-tools 1.0.4__py3-none-any.whl → 1.0.5__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.
@@ -1,4 +1,4 @@
1
- from bottle import ServerAdapter
1
+ from bottle import ServerAdapter, Bottle, template
2
2
  from socketserver import ThreadingMixIn
3
3
  from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, make_server
4
4
 
@@ -35,6 +35,29 @@ http_server = bottle_server.WSGIRefServer(port=application.Server.port)
35
35
  http_app.run(server=http_server, quiet=True)
36
36
  """
37
37
 
38
+ class CBottle:
39
+
40
+ def __init__(self, bottle: Bottle, port=8888, quiet=False):
41
+ self.port = port
42
+ self.quiet = quiet
43
+ self.bottle = bottle
44
+
45
+ def run(self):
46
+ http_server = WSGIRefServer(port=self.port)
47
+ self.bottle.run(server=http_server, quiet=self.quiet)
48
+
49
+ def set_index(self, path, **kwargs):
50
+ @self.bottle.route(['/', '/index'])
51
+ def index():
52
+ return template(path, kwargs)
53
+
54
+ def mount(self, context_path, app):
55
+ self.bottle.mount(context_path, app)
56
+
57
+ def init_bottle(port=8888, quiet=False) -> CBottle:
58
+ bottle = Bottle()
59
+ return CBottle(bottle, port, quiet)
60
+
38
61
  class ThreadedWSGIServer(ThreadingMixIn, WSGIServer): pass
39
62
 
40
63
  class CustomWSGIHandler(WSGIRequestHandler):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gomyck-tools
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: A ctools for python development by hao474798383
5
5
  Home-page: https://blog.gomyck.com
6
6
  Author: gomyck
@@ -4,7 +4,7 @@ ctools/api_result.py,sha256=NiM-R9K42G3m16B27sG_mqKrlexZzC5-LKoY8D5tO4s,1239
4
4
  ctools/application.py,sha256=WviU7p9GOqducbGW3XGkP7jCNKmraCh6JGSYBC33CQk,16008
5
5
  ctools/b64.py,sha256=_BdhX3p3-MaSSlU2wivN5qPxQfacR3VRBr1WC456tU0,194
6
6
  ctools/bashPath.py,sha256=BCN_EhYzqvwsxYso81omMNd3SbEociwSOyb9kLvu8V4,337
7
- ctools/bottle_webserver.py,sha256=ssZSepcihbukOl-BUyPLYdj4jsQRBoD6Dq4rqjss5YE,1572
7
+ ctools/bottle_webserver.py,sha256=blqeVlqBXns9CjrDl_cPXp47pfYjXQtcuNwdrC2oI_o,2186
8
8
  ctools/bottle_websocket.py,sha256=aO5s1zlPVxjUj86529UkEXywmuaDK5qFvorsW5RIBEY,1583
9
9
  ctools/browser_element_tools.py,sha256=tWNxUJ9m-hNTYtS0NRvmH9r5I-Qw55uKekwDYgt49bc,9951
10
10
  ctools/call.py,sha256=BCr8wzt5qd70okv8IZn-9-EpjywleZgvA3u1vfZ_Kt8,1581
@@ -51,7 +51,7 @@ ctools/wordFill.py,sha256=dB1OLt6GLmWdkDV8H20VWbJmY4ggNNI8iHD1ocae2iM,875
51
51
  ctools/word_fill.py,sha256=aIkzjAF2soSW6w2dO2CRZlveDcuIdr6v9DtyyyB8uxM,18216
52
52
  ctools/word_fill_entity.py,sha256=eX3G0Gy16hfGpavQSEkCIoKDdTnNgRRJrFvKliETZK8,985
53
53
  ctools/work_path.py,sha256=i4MTUobqNW2WMrT3mwEC_XYQ0_IhFmKoNpTX2W6A8Tc,1680
54
- gomyck_tools-1.0.4.dist-info/METADATA,sha256=iS_5GtFgNjro54IcaZQVyLKycAqwN_ghaZAuy2buDYU,712
55
- gomyck_tools-1.0.4.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
56
- gomyck_tools-1.0.4.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
57
- gomyck_tools-1.0.4.dist-info/RECORD,,
54
+ gomyck_tools-1.0.5.dist-info/METADATA,sha256=K2Wm9YWf91WlSnS0Vf4fIUUTu5dNVFZJUY_dX05n4qE,712
55
+ gomyck_tools-1.0.5.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
56
+ gomyck_tools-1.0.5.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
57
+ gomyck_tools-1.0.5.dist-info/RECORD,,