当前位置: 首页>>代码示例>>Python>>正文


Python HTTPServer.__init__方法代码示例

本文整理汇总了Python中http.server.HTTPServer.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPServer.__init__方法的具体用法?Python HTTPServer.__init__怎么用?Python HTTPServer.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在http.server.HTTPServer的用法示例。


在下文中一共展示了HTTPServer.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(
        self,
        host,
        port,
        app,
        processes=40,
        handler=None,
        passthrough_errors=False,
        ssl_context=None,
        fd=None,
    ):
        if not can_fork:
            raise ValueError("Your platform does not support forking.")
        BaseWSGIServer.__init__(
            self, host, port, app, handler, passthrough_errors, ssl_context, fd
        )
        self.max_children = processes 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:19,代码来源:serving.py

示例2: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(self, addr, handler, poll_interval=0.5,
                     log=False, sslctx=None):
            class DelegatingHTTPRequestHandler(BaseHTTPRequestHandler):
                def __getattr__(self, name, default=None):
                    if name.startswith('do_'):
                        return self.process_request
                    raise AttributeError(name)

                def process_request(self):
                    self.server._handler(self)

                def log_message(self, format, *args):
                    if log:
                        super(DelegatingHTTPRequestHandler,
                              self).log_message(format, *args)
            HTTPServer.__init__(self, addr, DelegatingHTTPRequestHandler)
            ControlMixin.__init__(self, handler, poll_interval)
            self.sslctx = sslctx 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:20,代码来源:test_logging.py

示例3: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(self):
        self.hostname = None
        self.port = None

        #这是请求
        self.command = None
        self.path = None
        self.request_version = None

        #这是响应
        self.response_version = None
        self.status = None
        self.reason = None

        self._headers = None

        self._body = b'' 
开发者ID:qiyeboy,项目名称:BaseProxy,代码行数:19,代码来源:proxy.py

示例4: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(self, host, port, app, handler=None,
                 passthrough_errors=False, ssl_context=None):
        if handler is None:
            handler = WSGIRequestHandler
        self.address_family = select_ip_version(host, port)
        HTTPServer.__init__(self, (host, int(port)), handler)
        self.app = app
        self.passthrough_errors = passthrough_errors
        self.shutdown_signal = False

        if ssl_context is not None:
            if isinstance(ssl_context, tuple):
                ssl_context = load_ssl_context(*ssl_context)
            if ssl_context == 'adhoc':
                ssl_context = generate_adhoc_ssl_context()
            self.socket = ssl_context.wrap_socket(self.socket,
                                                  server_side=True)
            self.ssl_context = ssl_context
        else:
            self.ssl_context = None 
开发者ID:chalasr,项目名称:Flask-P2P,代码行数:22,代码来源:serving.py

示例5: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(self, protocol):
        self._protocol = protocol
        self._certfile = None
        self._keyfile = None
        self._password = None 
开发者ID:jpush,项目名称:jbox,代码行数:7,代码来源:serving.py

示例6: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(self, file):
  BytesIO.__init__(self)
  self.wrappedFile = file 
开发者ID:ma1co,项目名称:Sony-PMCA-RE,代码行数:5,代码来源:server.py

示例7: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(self, rfile):
        self._rfile = rfile
        self._done = False
        self._len = 0 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:6,代码来源:serving.py

示例8: __init__

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import __init__ [as 别名]
def __init__(self, RequestHandlerClass=ProxyRequestHandler, **kwargs):
        # Save off proxy specific options
        self.target_host = kwargs.pop('target_host', None)
        self.target_port = kwargs.pop('target_port', None)
        self.wrap_cmd = kwargs.pop('wrap_cmd', None)
        self.wrap_mode = kwargs.pop('wrap_mode', None)
        self.unix_target = kwargs.pop('unix_target', None)
        self.ssl_target = kwargs.pop('ssl_target', None)
        self.token_plugin = kwargs.pop('token_plugin', None)
        self.auth_plugin = kwargs.pop('auth_plugin', None)
        self.heartbeat = kwargs.pop('heartbeat', None)

        self.token_plugin = None
        self.auth_plugin = None
        self.daemon = False

        # Server configuration
        listen_host = kwargs.pop('listen_host', '')
        listen_port = kwargs.pop('listen_port', None)
        web = kwargs.pop('web', '')

        # Configuration affecting base request handler
        self.only_upgrade = not web
        self.verbose = kwargs.pop('verbose', False)
        record = kwargs.pop('record', '')
        if record:
            self.record = os.path.abspath(record)
        self.run_once = kwargs.pop('run_once', False)
        self.handler_id = 0

        for arg in kwargs.keys():
            print("warning: option %s ignored when using --libserver" % arg)

        if web:
            os.chdir(web)

        HTTPServer.__init__(self, (listen_host, listen_port),
                            RequestHandlerClass) 
开发者ID:jamesacampbell,项目名称:python-examples,代码行数:40,代码来源:websockify-example.py


注:本文中的http.server.HTTPServer.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。