當前位置: 首頁>>代碼示例>>Python>>正文


Python HTTPServer.serve_forever方法代碼示例

本文整理匯總了Python中BaseHTTPServer.HTTPServer.serve_forever方法的典型用法代碼示例。如果您正苦於以下問題:Python HTTPServer.serve_forever方法的具體用法?Python HTTPServer.serve_forever怎麽用?Python HTTPServer.serve_forever使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BaseHTTPServer.HTTPServer的用法示例。


在下文中一共展示了HTTPServer.serve_forever方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: serve_forever

# 需要導入模塊: from BaseHTTPServer import HTTPServer [as 別名]
# 或者: from BaseHTTPServer.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 BaseHTTPServer import HTTPServer [as 別名]
# 或者: from BaseHTTPServer.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 BaseHTTPServer import HTTPServer [as 別名]
# 或者: from BaseHTTPServer.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 BaseHTTPServer import HTTPServer [as 別名]
# 或者: from BaseHTTPServer.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


注:本文中的BaseHTTPServer.HTTPServer.serve_forever方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。