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


Python BaseHTTPServer.BaseHTTPRequestHandler方法代码示例

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


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

示例1: __init__

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def __init__(self, multiplexer, name_to_plugin_dict, logdir, *args):
    self._multiplexer = multiplexer
    self._registered_plugins = name_to_plugin_dict
    self._logdir = logdir
    self._setup_data_handlers()
    BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:8,代码来源:handler.py

示例2: log_message

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def log_message(self, *args):
    """Logs message."""
    # By default, BaseHTTPRequestHandler logs to stderr.
    logging.info(*args)

  # @Override 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:8,代码来源:handler.py

示例3: log_request

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def log_request(self, *args):
    """Does nothing."""
    # This is called by BaseHTTPRequestHandler.send_response() which causes it
    # to log every request. We've configured http.Respond() to only log
    # requests with >=400 status code.
    pass 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:8,代码来源:handler.py

示例4: log_message

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def log_message(self, format, *args):
        """Log messages from the BaseHTTPRequestHandler class."""
        self.server.log_callback("BASE CLASS: {}".format(format % args)) 
开发者ID:Morgan-Stanley,项目名称:testplan,代码行数:5,代码来源:server.py

示例5: get_options

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def get_options(cls):
        """
        Schema for options validation and assignment of default values.
        """
        return {
            Optional("host", default="localhost"): str,
            Optional("port", default=0): Use(int),
            Optional(
                "request_handler", default=HTTPRequestHandler
            ): lambda v: issubclass(v, http_server.BaseHTTPRequestHandler),
            Optional("handler_attributes", default={}): dict,
            Optional("timeout", default=5): Use(int),
            Optional("interval", default=0.01): Use(float),
        } 
开发者ID:Morgan-Stanley,项目名称:testplan,代码行数:16,代码来源:server.py

示例6: __init__

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def __init__(self,
                 processor,
                 server_address,
                 inputProtocolFactory,
                 outputProtocolFactory=None,
                 server_class=BaseHTTPServer.HTTPServer):
        """Set up protocol factories and HTTP server.

        See BaseHTTPServer for server_address.
        See TServer for protocol factories.
        """
        if outputProtocolFactory is None:
            outputProtocolFactory = inputProtocolFactory

        TServer.TServer.__init__(self, processor, None, None, None,
                                 inputProtocolFactory, outputProtocolFactory)

        thttpserver = self

        class RequestHander(BaseHTTPServer.BaseHTTPRequestHandler):
            def do_POST(self):
                # Don't care about the request path.
                itrans = TTransport.TFileObjectTransport(self.rfile)
                otrans = TTransport.TFileObjectTransport(self.wfile)
                itrans = TTransport.TBufferedTransport(
                    itrans, int(self.headers['Content-Length']))
                otrans = TTransport.TMemoryBuffer()
                iprot = thttpserver.inputProtocolFactory.getProtocol(itrans)
                oprot = thttpserver.outputProtocolFactory.getProtocol(otrans)
                try:
                    thttpserver.processor.process(iprot, oprot)
                except ResponseException as exn:
                    exn.handler(self)
                else:
                    self.send_response(200)
                    self.send_header("content-type", "application/x-thrift")
                    self.end_headers()
                    self.wfile.write(otrans.getvalue())

        self.httpd = server_class(server_address, RequestHander) 
开发者ID:Aditmadzs,项目名称:Protect4,代码行数:42,代码来源:THttpServer.py

示例7: __init__

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def __init__(self, multiplexer, logdir, *args):
    self._multiplexer = multiplexer
    self._logdir = logdir
    self._setup_data_handlers()
    BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args) 
开发者ID:tobegit3hub,项目名称:deep_image_model,代码行数:7,代码来源:handler.py

示例8: __init__

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def __init__(self, clusters, output_path, *args):
    self.clusters = clusters
    self.output_path = output_path
    BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args) 
开发者ID:tensorflow,项目名称:moonlight,代码行数:6,代码来源:kmeans_labeler_request_handler.py

示例9: __init__

# 需要导入模块: from six.moves import BaseHTTPServer [as 别名]
# 或者: from six.moves.BaseHTTPServer import BaseHTTPRequestHandler [as 别名]
def __init__(self,
                 processor,
                 server_address,
                 inputProtocolFactory,
                 outputProtocolFactory=None,
                 server_class=BaseHTTPServer.HTTPServer):
        if outputProtocolFactory is None:
            outputProtocolFactory = inputProtocolFactory
        TServer.TServer.__init__(self, processor, None, None, None,
                                 inputProtocolFactory, outputProtocolFactory)
        thttpserver = self
        class RequestHander(BaseHTTPServer.BaseHTTPRequestHandler):
            def do_POST(self):
                itrans = TTransport.TFileObjectTransport(self.rfile)
                otrans = TTransport.TFileObjectTransport(self.wfile)
                itrans = TTransport.TBufferedTransport(
                    itrans, int(self.headers['Content-Length']))
                otrans = TTransport.TMemoryBuffer()
                iprot = thttpserver.inputProtocolFactory.getProtocol(itrans)
                oprot = thttpserver.outputProtocolFactory.getProtocol(otrans)
                try:
                    thttpserver.processor.process(iprot, oprot)
                except ResponseException as exn:
                    exn.handler(self)
                else:
                    self.send_response(200)
                    self.send_header("content-type", "application/x-thrift")
                    self.end_headers()
                    self.wfile.write(otrans.getvalue())
        self.httpd = server_class(server_address, RequestHander) 
开发者ID:stya535,项目名称:SOLO,代码行数:32,代码来源:THttpServer.py


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