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


Python HTTPServer.serve_forever方法代码示例

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


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

示例1: serve_forever

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import serve_forever [as 别名]
def serve_forever(self):
        self.shutdown_signal = False
        try:
            if os.environ.get('WERKZEUG_RUN_MAIN') != 'true':
                display_hostname = self.host != '*' and self.host or 'localhost'
                if ':' in display_hostname:
                    display_hostname = '[%s]' % display_hostname
                quit_msg = '(Press CTRL+C to quit)'
                _log('info', ' * Running on %s://%s:%d/ %s',
                     self.ssl_context is None and 'http' or 'https',
                     display_hostname, self.port, quit_msg)
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
开发者ID:jmankoff,项目名称:data,代码行数:18,代码来源:serving.py

示例2: serve_forever

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import serve_forever [as 别名]
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:10,代码来源:serving.py

示例3: serve_forever

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import serve_forever [as 别名]
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass 
开发者ID:googlearchive,项目名称:cloud-playground,代码行数:8,代码来源:serving.py

示例4: run_forever

# 需要导入模块: from http.server import HTTPServer [as 别名]
# 或者: from http.server.HTTPServer import serve_forever [as 别名]
def run_forever(self, poll_interval=0.5, progress_file=None):
        """Almost synonym for HTTPServer::serve_forever
        Handles requests until an explicit shutdown() request. Poll for
        shutdown every poll_interval seconds

        :param float poll_interval: Time in seconds to poll for shutdown.
        :param str progress_file: A JSON file with current status of a
                                  benchmarking experiment.
        """
        self.RequestHandlerClass.PROGRESS_FILE = progress_file
        HTTPServer.serve_forever(self, poll_interval) 
开发者ID:HewlettPackard,项目名称:dlcookbook-dlbs,代码行数:13,代码来源:simple_server.py


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