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


Python BaseHTTPRequestHandler.handle_one_request方法代码示例

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


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

示例1: handle_one_request

# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import handle_one_request [as 别名]
    def handle_one_request(self):
        """Extended request handler

        This is where WebSocketRequestHandler redirects requests to the
        new methods. Any sub-classes must call this method in order for
        the calls to function.
        """
        self._real_do_GET = self.do_GET
        self.do_GET = self._websocket_do_GET
        try:
            BaseHTTPRequestHandler.handle_one_request(self)
        finally:
            self.do_GET = self._real_do_GET
开发者ID:michalsrb,项目名称:websockify,代码行数:15,代码来源:websocketserver.py

示例2: handle_one_request

# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import handle_one_request [as 别名]
    def handle_one_request(self):
        """Catch more exceptions than default

        Intend to catch exceptions on local side
        Exceptions on remote side should be handled in do_*()
        """
        try:
            BaseHTTPRequestHandler.handle_one_request(self)
            return
        except (ConnectionError, FileNotFoundError) as e:
            logger.warning("%03d " % self.reqNum + Fore.RED + "%s %s", self.server_version, e)
        except (ssl.SSLEOFError, ssl.SSLError) as e:
            if hasattr(self, 'url'):
                # Happens after the tunnel is established
                logger.warning("%03d " % self.reqNum + Fore.YELLOW + '"%s" while operating on established local SSL tunnel for [%s]' % (e, self.url))
            else:
                logger.warning("%03d " % self.reqNum + Fore.YELLOW + '"%s" while trying to establish local SSL tunnel for [%s]' % (e, self.path))
        self.close_connection = 1
开发者ID:PavelRykov,项目名称:ProxHTTPSProxyMII,代码行数:20,代码来源:ProxyTool.py

示例3: handle_one_request

# 需要导入模块: from http.server import BaseHTTPRequestHandler [as 别名]
# 或者: from http.server.BaseHTTPRequestHandler import handle_one_request [as 别名]
    def handle_one_request(self):
        """Extended request handler

        This is where WebSocketRequestHandler redirects requests to the
        new methods. Any sub-classes must call this method in order for
        the calls to function.
        """
        self._real_do_GET = self.do_GET
        self.do_GET = self._websocket_do_GET
        try:
            # super() only works for new style classes
            if issubclass(WebSocketRequestHandlerMixIn, object):
                super(WebSocketRequestHandlerMixIn, self).handle_one_request()
            else:
                # Assume handle_one_request() hasn't been overriden
                BaseHTTPRequestHandler.handle_one_request(self)
        finally:
            self.do_GET = self._real_do_GET
开发者ID:PKRoma,项目名称:websockify,代码行数:20,代码来源:websocketserver.py


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