• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python wsgi_wrappers.init_app函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_invalid_config

 def test_invalid_config(self):
     with raises(IOError):
         init_app(create_wb_router,
                  load_yaml=True,
                  config_file='x-invalid-x')
开发者ID:jasonliw93,项目名称:recon,代码行数:5,代码来源:test_integration.py


示例17: init_app

from pywb.framework.wsgi_wrappers import init_app, start_wsgi_server

# from pywb.core.cdx_api_handler import create_cdx_server_app
from pywb.webapp.pywb_init import create_cdx_server_app

# =================================================================
# init cdx server app
# =================================================================

application = init_app(create_cdx_server_app, load_yaml=True)


def main():  # pragma: no cover
    start_wsgi_server(application, "CDX Server", default_port=8090)


if __name__ == "__main__":
    main()
开发者ID:jasonliw93,项目名称:recon,代码行数:18,代码来源:cdx_server.py


示例18: setup

 def setup(self):
     self.app = init_app(create_live_rewriter_app, load_yaml=False,
                         config=dict(framed_replay=True))
     self.testapp = webtest.TestApp(self.app)
开发者ID:akeprojecta,项目名称:pywb,代码行数:4,代码来源:test_live_rewriter.py


示例19: _create_app

 def _create_app(self):
     self.app = init_app(create_wb_router)
     self.testapp = webtest.TestApp(self.app)
开发者ID:machawk1,项目名称:pywb,代码行数:3,代码来源:test_auto_colls.py


示例20: init_app

from pywb.framework.wsgi_wrappers import init_app
from pywb.webapp.pywb_init import create_wb_router


#=================================================================
# init pywb app
#=================================================================
application = init_app(create_wb_router, load_yaml=True)
开发者ID:akeprojecta,项目名称:pywb,代码行数:8,代码来源:wayback.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python manager.main函数代码示例发布时间:2022-05-26
下一篇:
Python sql.SQLContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap