server.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:iconograph 作者: robot-tools 项目源码 文件源码
def __init__(self, listen_host, listen_port, server_key, server_cert, ca_cert, image_path, image_types, exec_handlers, static_paths):
    websockets = WebSockets()

    wm = pyinotify.WatchManager()
    inotify_handler = INotifyHandler(websockets)
    self._notifier = pyinotify.Notifier(wm, inotify_handler)
    for image_type in image_types:
      type_path = os.path.join(image_path, image_type)
      wm.add_watch(type_path, pyinotify.IN_MOVED_TO)

    exec_handlers = dict(x.split('=', 1) for x in (exec_handlers or []))
    static_paths = dict(x.split('=', 1) for x in (static_paths or []))
    http_handler = HTTPRequestHandler(image_path, image_types, exec_handlers, static_paths, websockets)
    self._httpd = geventserver.WSGIServer(
        (listen_host, listen_port),
        http_handler,
        keyfile=server_key,
        certfile=server_cert,
        ca_certs=ca_cert,
        cert_reqs=ssl.CERT_REQUIRED,
        ssl_version=ssl.PROTOCOL_TLSv1_2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号