python类WSGIContainer()的实例源码

wsgi_test.py 文件源码 项目:noc-orchestrator 作者: DirceuSilvaLabs 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def wrap_web_tests_application():
    result = {}
    for cls in web_test.wsgi_safe_tests:
        class WSGIApplicationWrappedTest(cls):
            def get_app(self):
                self.app = WSGIApplication(self.get_handlers(),
                                           **self.get_app_kwargs())
                return WSGIContainer(validator(self.app))
        result["WSGIApplication_" + cls.__name__] = WSGIApplicationWrappedTest
    return result
webservers.py 文件源码 项目:drift 作者: dgnorth 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def run_tornado_server(app, port):

    from tornado.wsgi import WSGIContainer
    from tornado.httpserver import HTTPServer
    from tornado.ioloop import IOLoop
    log.info("Activating Tornado server on port %s", port)
    http_server = HTTPServer(WSGIContainer(app), xheaders=True)
    http_server.listen(port)
    IOLoop.instance().start()
main.py 文件源码 项目:hoplite 作者: ni 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def server_main(args=sys.argv):
    parser = get_server_options_parser()
    # sys.argv includes the path of invocation as the first index in the list
    # argparse expects just the parameters if we pass a list into parse_args
    # so here we get rid of that path parameter and are left with only the args
    # from the command line
    if args == sys.argv:
        args = args[1:]
    args = parser.parse_args(args)

    HopliteServerSettings.debug = args.debug

    app = create_app()
    logger.info('Starting Hoplite server on port {}'.format(args.port))
    http_server = HTTPServer(WSGIContainer(app))
    http_server.listen(args.port)
    ioloop = IOLoop.instance()
    # This is needed to ensure Ctrl-C kills the server quickly
    set_ping(ioloop, timedelta(seconds=2))
    try:
        ioloop.start()
    except:
        raise
    finally:
        # Ensure that the server always closes the socket when it's no longer
        # in use
        ioloop.stop()
tornado_wsgi.py 文件源码 项目:web_develop 作者: dongweiming 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def main():
    define('port', default=9000, type=int, help='Port on which to listen.')
    parse_command_line()

    http_server = HTTPServer(WSGIContainer(app))
    http_server.listen(options.port)
    IOLoop.instance().start()
wsgi_test.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def get_app(self):
        return WSGIContainer(validator(self.wsgi_app))
wsgi_test.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_types(self):
        headers = {"Cookie": "foo=bar"}
        response = self.fetch("/typecheck?foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

        response = self.fetch("/typecheck", method="POST", body="foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

# This is kind of hacky, but run some of the HTTPServer tests through
# WSGIContainer and WSGIApplication to make sure everything survives
# repeated disassembly and reassembly.
wsgi_test.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def get_app(self):
        return WSGIContainer(validator(WSGIApplication(self.get_handlers())))
wsgi_test.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def wrap_web_tests_application():
    result = {}
    for cls in web_test.wsgi_safe_tests:
        class WSGIApplicationWrappedTest(cls):
            def get_app(self):
                self.app = WSGIApplication(self.get_handlers(),
                                           **self.get_app_kwargs())
                return WSGIContainer(validator(self.app))
        result["WSGIApplication_" + cls.__name__] = WSGIApplicationWrappedTest
    return result
wsgi_test.py 文件源码 项目:time2go 作者: twitchyliquid64 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def get_app(self):
        return WSGIContainer(validator(self.wsgi_app))
wsgi_test.py 文件源码 项目:time2go 作者: twitchyliquid64 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_path_quoting(self):
        response = self.fetch("/path/foo%20bar%C3%A9")
        self.assertEqual(response.body, u"foo bar\u00e9".encode("utf-8"))

# This is kind of hacky, but run some of the HTTPServer tests through
# WSGIContainer and WSGIApplication to make sure everything survives
# repeated disassembly and reassembly.
wsgi_test.py 文件源码 项目:time2go 作者: twitchyliquid64 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def get_app(self):
        return WSGIContainer(validator(WSGIApplication(self.get_handlers())))
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def get_app(self):
        return WSGIContainer(validator(self.wsgi_app))
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_types(self):
        headers = {"Cookie": "foo=bar"}
        response = self.fetch("/typecheck?foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

        response = self.fetch("/typecheck", method="POST", body="foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

# This is kind of hacky, but run some of the HTTPServer tests through
# WSGIContainer and WSGIApplication to make sure everything survives
# repeated disassembly and reassembly.
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def get_app(self):
        return WSGIContainer(validator(WSGIApplication(self.get_handlers())))
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 40 收藏 0 点赞 0 评论 0
def wrap_web_tests():
    result = {}
    for cls in web_test.wsgi_safe_tests:
        class WSGIWrappedTest(cls):
            def get_app(self):
                self.app = WSGIApplication(self.get_handlers(),
                                           **self.get_app_kwargs())
                return WSGIContainer(validator(self.app))
        result["WSGIWrapped_" + cls.__name__] = WSGIWrappedTest
    return result
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_types(self):
        headers = {"Cookie": "foo=bar"}
        response = self.fetch("/typecheck?foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

        response = self.fetch("/typecheck", method="POST", body="foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

# This is kind of hacky, but run some of the HTTPServer tests through
# WSGIContainer and WSGIApplication to make sure everything survives
# repeated disassembly and reassembly.
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def get_app(self):
        return WSGIContainer(validator(WSGIApplication(self.get_handlers())))
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def wrap_web_tests_application():
    result = {}
    for cls in web_test.wsgi_safe_tests:
        class WSGIApplicationWrappedTest(cls):
            def get_app(self):
                self.app = WSGIApplication(self.get_handlers(),
                                           **self.get_app_kwargs())
                return WSGIContainer(validator(self.app))
        result["WSGIApplication_" + cls.__name__] = WSGIApplicationWrappedTest
    return result
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def wrap_web_tests_adapter():
    result = {}
    for cls in web_test.wsgi_safe_tests:
        class WSGIAdapterWrappedTest(cls):
            def get_app(self):
                self.app = Application(self.get_handlers(),
                                       **self.get_app_kwargs())
                return WSGIContainer(validator(WSGIAdapter(self.app)))
        result["WSGIAdapter_" + cls.__name__] = WSGIAdapterWrappedTest
    return result
wsgi_test.py 文件源码 项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_types(self):
        headers = {"Cookie": "foo=bar"}
        response = self.fetch("/typecheck?foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

        response = self.fetch("/typecheck", method="POST", body="foo=bar", headers=headers)
        data = json_decode(response.body)
        self.assertEqual(data, {})

# This is kind of hacky, but run some of the HTTPServer tests through
# WSGIContainer and WSGIApplication to make sure everything survives
# repeated disassembly and reassembly.


问题


面经


文章

微信
公众号

扫码关注公众号