Best Python code snippet using fMBT_python
proxy.py
Source:proxy.py  
...102            self.startHTTPServer()103104    def shutdownHTTPServer(self):105        with self.settingsChangeLock:106            self.stopHTTPServer()107            self.isShutdown = True108109    def startHTTPServer(self):110        if self.isShutdown:111            return112113        self.stopHTTPServer()114115        try:116            self.HTTPServer = HTTPServer(self, ('', settings.getInt(key='_proxyserver_port')))117        except IOError as e:118            pass119120        threadStarting = threading.Thread(target=self.HTTPServer.serve_forever)121        threadStarting.start()122        self.HTTPServerThread = threadStarting123124    def stopHTTPServer(self):125        if self.HTTPServer is not None:126            self.HTTPServer.shutdown()127            self.HTTPServer = None128        if self.HTTPServerThread is not None:129            self.HTTPServerThread.join()
...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
