当前位置: 首页>>代码示例>>Python>>正文


Python wsgi_wrappers.init_app函数代码示例

本文整理汇总了Python中pywb.framework.wsgi_wrappers.init_app函数的典型用法代码示例。如果您正苦于以下问题:Python init_app函数的具体用法?Python init_app怎么用?Python init_app使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了init_app函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load

    def load(self):
        config = dict(proxyhostport=self.r.proxy,
                      framed_replay='inverse' if self.r.framed else False,
                      enable_auto_colls=False,
                      collections={'live': '$liveweb'})

        return init_app(create_wb_router, load_yaml=False, config=config)
开发者ID:machawk1,项目名称:pywb,代码行数:7,代码来源:cli.py

示例2: __init__

    def __init__(self, archivefiles):
        self.archivefiles = archivefiles

        self.coll_name = ''

        self.cdx_file = tempfile.NamedTemporaryFile(delete=False,
                                                    suffix='.cdxj',
                                                    prefix='cdx')

        self.path_index = tempfile.NamedTemporaryFile(delete=False,
                                                      suffix='.txt')

        try:
            pagelist = self.update_cdx(self.cdx_file, archivefiles)
        except Exception as e:
            msg = "WebArchivePlayer is unable to read the input file(s) and will quit.\n\nDetails: " + str(e)[:255]
            if no_wx:
                sys.stderr.write(msg + '\n')
            else:
                dlg = wx.MessageDialog(None, msg, "Error Reading Web Archive File(s)", style=wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
            sys.exit(1)

        config = self._load_dynamic_config()
        config['_pagelist'] = pagelist

        config['_archivefiles'] = archivefiles
        self.write_path_index()
        self.application = init_app(create_wb_router,
                                    load_yaml=False,
                                    config=config)
开发者ID:bigalexstrong,项目名称:webarchiveplayer,代码行数:31,代码来源:archiveplayer.py

示例3: setup_module

def setup_module():
    global requestlog
    requestlog = []

    def make_httpd(app):
        global proxyserv
        proxyserv = ProxyServer(('', 0), ProxyRequest)
        proxyserv.requestlog = requestlog
        proxyserv.force_err = False
        return proxyserv

    global server
    server = ServerThreadRunner(make_httpd)

    config = dict(collections=dict(rewrite='$liveweb'),
                  framed_replay=True,
                  proxyhostport=server.proxy_dict)

    global cache
    cache = {}

    def create_cache():
        return cache

    pywb.webapp.live_rewrite_handler.create_cache = create_cache

    global app
    app = init_app(create_wb_router,
                   load_yaml=False,
                   config=config)

    global testapp
    testapp = webtest.TestApp(app)
开发者ID:robertknight,项目名称:pywb,代码行数:33,代码来源:test_live_proxy.py

示例4: test_err_app

def test_err_app():
    the_app = init_app(initer(TestErrApp), load_yaml=False)

    testapp = webtest.TestApp(the_app)
    resp = testapp.get('/abc', expect_errors=True)

    assert resp.status_int == 400
    assert '400 Bad Request Error: Test Error' in resp.body
开发者ID:tilgovi,项目名称:pywb,代码行数:8,代码来源:test_wsgi_wrapper.py

示例5: test_ok_app

def test_ok_app():
    the_app = init_app(initer(TestOkApp), load_yaml=False)

    testapp = webtest.TestApp(the_app)
    resp = testapp.get('/')

    assert resp.status_int == 200
    assert 'Test' in resp.body
开发者ID:Orbiter,项目名称:pywb,代码行数:8,代码来源:test_wsgi_wrapper.py

示例6: make_app

def make_app(config_file, pywb_router=create_wb_router):
    app = init_app(pywb_router,
                   load_yaml=True,
                   config_file=config_file)

    testapp = TestApp(app)

    return app, testapp
开发者ID:Orbiter,项目名称:pywb,代码行数:8,代码来源:server_mock.py

示例7: test_custom_err_app

def test_custom_err_app():
    the_app = init_app(initer(TestCustomErrApp), load_yaml=False)

    testapp = webtest.TestApp(the_app)
    resp = testapp.get('/abc', expect_errors=True)

    assert resp.status_int == 403
    assert '403 Access Denied Error: Forbidden Test' in resp.body
开发者ID:Orbiter,项目名称:pywb,代码行数:8,代码来源:test_wsgi_wrapper.py

示例8: test_err_app

def test_err_app():
    the_app = init_app(initer(TestErrApp), load_yaml=False)

    testapp = webtest.TestApp(the_app)
    resp = testapp.get('/abc', expect_errors=True)

    assert resp.status_int == 500
    assert '500 Internal Server Error Error: Test Unexpected Error' in resp.body
开发者ID:Orbiter,项目名称:pywb,代码行数:8,代码来源:test_wsgi_wrapper.py

示例9: setup

    def setup(self):
        #self.app = pywb.wbapp.create_wb_app(pywb.pywb_init.pywb_config())
        # save it in self - useful for debugging
        self.app = init_app(create_wb_router,
                            load_yaml=True,
                            config_file=self.TEST_CONFIG)

        #self.router = pywb_config(self.TEST_CONFIG)
        #self.app = create_wb_app(self.router)

        self.testapp = webtest.TestApp(self.app)
开发者ID:jasonliw93,项目名称:recon,代码行数:11,代码来源:test_integration.py

示例10: __init__

    def __init__(self, *args, **kwargs):
        super(ServeThread, self).__init__(*args, **kwargs)
        self.app = init_app(create_wb_router,
                            load_yaml=True,
                            config_file=TEST_CONFIG)

        # init with port 0 to allow os to pick a port
        self.httpd = make_server('', 0, self.app)
        port = self.httpd.socket.getsockname()[1]

        proxy_str = 'http://localhost:' + str(port)
        self.proxy_dict = {'http': proxy_str}
开发者ID:jasonliw93,项目名称:recon,代码行数:12,代码来源:test_proxy_http_cookie.py

示例11: make_app

def make_app(config_file, pywb_router=create_wb_router):
    app = init_app(pywb_router, load_yaml=True, config_file=config_file)

    testapp = TestApp(app)

    class Resp(TestResponse):
        def __init__(self, *args, **kwargs):
            super(Resp, self).__init__(*args, **kwargs)
            if self.headers.get("Content-Type"):
                self.charset = "utf-8"

    TestApp.RequestClass.ResponseClass = Resp

    return app, testapp
开发者ID:eriknstr,项目名称:pywb,代码行数:14,代码来源:server_mock.py

示例12: create_app

def create_app():
    parser = ArgumentParser(description='Live Rewrite Server')

    parser.add_argument('-x', '--proxy',
                        action='store',
                        help='Specify host:port to use as HTTP/S proxy')

    result, unknown = parser.parse_known_args()

    config = dict(proxyhostport=result.proxy, framed_replay=True)

    app = init_app(create_live_rewriter_app, load_yaml=False,
                   config=config)

    return app
开发者ID:jasonliw93,项目名称:recon,代码行数:15,代码来源:live_rewrite_server.py

示例13: __init__

    def __init__(self, make_httpd, config_file=None):

        if config_file:
            self.app = init_app(create_wb_router,
                                load_yaml=True,
                                config_file=config_file)
        else:
            self.app = None

        self.httpd = make_httpd(self.app)
        self.port = self.httpd.socket.getsockname()[1]

        proxy_str = 'http://localhost:' + str(self.port)
        self.proxy_dict = {'http': proxy_str,
                           'https': proxy_str}

        def run():
            self.httpd.serve_forever()

        self.thread = threading.Thread(target=run)
        self.thread.daemon = True
        self.thread.start()
开发者ID:akeprojecta,项目名称:pywb,代码行数:22,代码来源:server_thread.py

示例14: __init__

    def __init__(self, archivefiles):
        self.archivefiles = archivefiles

        self.coll_name = ''

        self.cdx_file = tempfile.NamedTemporaryFile(delete=False,
                                                    suffix='.cdxj',
                                                    prefix='cdx')

        self.path_index = tempfile.NamedTemporaryFile(delete=False,
                                                      suffix='.txt')

        pagelist = self.update_cdx(self.cdx_file, archivefiles)

        config = self._load_config()
        config['_pagelist'] = pagelist

        config['_archivefiles'] = archivefiles
        self.write_path_index()
        self.application = init_app(create_wb_router,
                                    load_yaml=False,
                                    config=config)
开发者ID:juli-so,项目名称:webarchiveplayer,代码行数:22,代码来源:archiveplayer.py

示例15: setup

    def setup(self):
        self.requestlog = []
        self.cache = {}

        def make_httpd(app):
            proxyserv = ProxyServer(("", 0), ProxyRequest)
            proxyserv.requestlog = self.requestlog
            proxyserv.force_err = False
            self.proxyserv = proxyserv
            return proxyserv

        self.server = ServerThreadRunner(make_httpd)

        config = dict(collections=dict(rewrite="$liveweb"), framed_replay=True, proxyhostport=self.server.proxy_dict)

        self.app = init_app(create_wb_router, load_yaml=False, config=config)

        def create_cache():
            return self.cache

        pywb.webapp.live_rewrite_handler.create_cache = create_cache

        self.testapp = webtest.TestApp(self.app)
开发者ID:jcushman,项目名称:pywb,代码行数:23,代码来源:test_live_proxy.py


注:本文中的pywb.framework.wsgi_wrappers.init_app函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。