def run(self): host, port = self.config.bind_addr self.server = _make_server(host, port, self.config.app) try: self.server.serve_forever() except KeyboardInterrupt: self.stop()
def make_server(host, port): with Configurator() as config: config.add_route('mock_oauth_verify', '/v1/verify') config.add_view(_mock_oauth_verify, route_name='mock_oauth_verify', renderer='json') config.add_route('mock_oauth_jwk', '/v1/jwks') config.add_view(_mock_oauth_jwk, route_name='mock_oauth_jwk', renderer='json') config.add_route('mock_browserid_verify', '/v2') config.add_view(_mock_browserid_verify, route_name='mock_browserid_verify', renderer='json') config.add_route('mock_config', '/config') config.add_view(_mock_config, route_name='mock_config', renderer='json') app = config.make_wsgi_app() return _make_server(host, port, app)
def make_server(host, port, app): return _make_server(host, port, app, RESTServer, RESTRequestHandler)
def make_server(host, port, app): return _make_server(host, port, app, handler_class=WSGIRequestHandler)
def create_server(app, host='', port=None): port = port or find_freeport() return _make_server(host, port, app, server_class=WSGIServer)
def make_server(port, app): with _make_server('', port, app) as httpd: httpd.serve_forever()