| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
asynchronous httpserver for kbengine using fd operation api of kbengine
为kbengine写的http server 框架。站在巨人肩膀上面,借鉴收纳了tornado 和 sanic的代码特性
类似于python tornado的使用方式,看下面的例子
from httpserver.app import Application, RequestHandler
class IndexHandler(RequestHandler):
def get(self, *args, **kwargs):
print("index, get")
self.write_text("index ok")
class HomeHandler(RequestHandler):
def get(self, *args, **kwargs):
print("home, get")
self.write_text("home ok")
def post(self, *args, **kwargs):
# DEBUG_MSG("post body, %s" % str(self.request.json))
self.write_json(self.request.json)
url_map = [
("/index", IndexHandler),
("/home", HomeHandler)
]
app = Application(url_map)
app.run("0.0.0.0", 9191)
主要使用步骤:
说明:
安装上面两个库的最新版本即可,另外在使用pip安装的时候一定要安装和引擎内置Python版本一致的Python,再用pip安装,这样才能正确在引擎的Python版本下正常运行。因为httptools库使用了c扩展,所以要保证Python版本一致
| Back | FazBrowse Home | New Git URL |