MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / startServer

Method startServer

service/esi.py:180–195  ·  view source on GitHub ↗
(self, port)

Source from the content-addressed store, hash-verified

178 self.httpd = None
179
180 def startServer(self, port): # todo: break this out into two functions: starting the server, and getting the URI
181 pyfalog.debug("Starting server")
182
183 # we need this to ensure that the previous get_request finishes, and then the socket will close
184 if self.httpd:
185 self.stopServer()
186 time.sleep(1)
187
188 self.httpd = StoppableHTTPServer(('localhost', port), AuthHandler)
189 port = self.httpd.socket.getsockname()[1]
190 self.serverThread = threading.Thread(target=self.httpd.serve, args=(self.handleServerRequest,))
191 self.serverThread.name = "SsoCallbackServer"
192 self.serverThread.daemon = True
193 self.serverThread.start()
194
195 return 'http://localhost:{}'.format(port)
196
197 def handleLogin(self, code):
198 auth_response, data = self.auth(code)

Callers 1

__init__Method · 0.80

Calls 2

stopServerMethod · 0.95
StoppableHTTPServerClass · 0.90

Tested by

no test coverage detected