Python http.server.HTTPServer.serve_forever() Examples

The following are 27 code examples of http.server.HTTPServer.serve_forever(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module http.server.HTTPServer , or try the search function .
Example #1
Source File: serving.py    From data with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #2
Source File: serving.py    From data with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #3
Source File: serving.py    From data with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #4
Source File: serving.py    From data with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #5
Source File: serving.py    From data with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #6
Source File: serving.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #7
Source File: serving.py    From Flask with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass 
Example #8
Source File: serving.py    From Flask with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass 
Example #9
Source File: serving.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #10
Source File: serving.py    From android_universal with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #11
Source File: serving.py    From Werkzeug-docs-cn with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass 
Example #12
Source File: serving.py    From appengine-try-python-flask with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass 
Example #13
Source File: simple_server.py    From dlcookbook-dlbs with Apache License 2.0 5 votes vote down vote up
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) 
Example #14
Source File: serving.py    From arithmancer with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass 
Example #15
Source File: serving.py    From recruit with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #16
Source File: serving.py    From cloud-playground with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass 
Example #17
Source File: serving.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #18
Source File: serving.py    From pyRevit with GNU General Public License v3.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #19
Source File: serving.py    From planespotter with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #20
Source File: serving.py    From Flask-P2P with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #21
Source File: serving.py    From Financial-Portfolio-Flask with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #22
Source File: serving.py    From scylla with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #23
Source File: serving.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #24
Source File: serving.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #25
Source File: serving.py    From RSSNewsGAE with Apache License 2.0 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #26
Source File: serving.py    From lambda-packs with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close() 
Example #27
Source File: serving.py    From jbox with MIT License 5 votes vote down vote up
def serve_forever(self):
        self.shutdown_signal = False
        try:
            HTTPServer.serve_forever(self)
        except KeyboardInterrupt:
            pass
        finally:
            self.server_close()