Beispiel #1
0
 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()
Beispiel #2
0
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)
Beispiel #3
0
def make_server(host, port, app):
    return _make_server(host, port, app, RESTServer, RESTRequestHandler)
Beispiel #4
0
def make_server(host, port, app):
    return _make_server(host, port, app,
                        handler_class=WSGIRequestHandler)
Beispiel #5
0
def create_server(app, host='', port=None):
    port = port or find_freeport()
    return _make_server(host, port, app, server_class=WSGIServer)
Beispiel #6
0
def make_server(port, app):
    with _make_server('', port, app) as httpd:
        httpd.serve_forever()
Beispiel #7
0
def make_server(host, port, app):
    return _make_server(host, port, app, handler_class=WSGIRequestHandler)