def stop(self):

        # Let the server finish the last request and wait for a new one.
        time.sleep(0.1)

        # self.shutdown is not supported on python < 2.6, so just
        #  set _run to false, and make a request, causing it to
        #  terminate.
        self._run = False
        url = 'http://127.0.0.1:%(server_port)s/' % vars(self)
        try:
            if sys.version_info >= (2, 6):
                urllib2.urlopen(url, timeout=5)
            else:
                urllib2.urlopen(url)
        except urllib2.URLError:
            # ignore any errors; all that's important is the request
            pass
        self.thread.join()
Stop the server
dataset/ETHPy150Open balanced/status.balancedpayments.com/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/setuptools/tests/server.py/IndexServer.stop