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

Python httplib2_intercept.install函数代码示例

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

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



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

示例1: setup_module

def setup_module(module):
    # cleanup
    try:
        shutil.rmtree('store')
    except OSError:
        pass

    # establish web server
    app = load_app()
    def app_fn():
        return app
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)

    # establish store
    store = Store(config['server_store'][0], config['server_store'][1],
            environ={'tiddlyweb.config': config})

    # make some stuff
    bag = Bag('place')
    store.put(bag)
    for i in range(1, 10):
        tiddler = Tiddler('tiddler%s' % i, 'place')
        tiddler.text = 'hi%s'
        store.put(tiddler)

    module.http = httplib2.Http()
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.etagcache,代码行数:27,代码来源:test_stress.py


示例2: setup_module

def setup_module(module):
    try:
        shutil.rmtree('indexdir')
        shutil.rmtree('store')
    except:
        pass

    app = load_app()

    def app_fn(): return app

    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('tankt.peermore.com', 8080, app_fn)

    store = get_store(config)
    test_bag = Bag('editable')

    try:
        store.delete(test_bag)
    except StoreError:
        pass

    store.put(test_bag)
    module.environ = {'tiddlyweb.store': store, 'tiddlyweb.config': config}
    module.store = store
    module.http = httplib2.Http()
    module.csrf = None
开发者ID:BillSeitz,项目名称:tank,代码行数:27,代码来源:test_edit.py


示例3: _initialize_app

def _initialize_app(tmpdir): # XXX: side-effecty and inscrutable
    instance_dir = os.path.join(tmpdir, 'instance')

    spawn(instance_dir, init_config, instance)
    old_cwd = os.getcwd()
    os.chdir(instance_dir)
    # force loading of instance's `tiddlywebconfig.py`
    while old_cwd in sys.path:
        sys.path.remove(old_cwd)
    sys.path.insert(0, os.getcwd())
    merge_config(CONFIG, {}, reconfig=True) # XXX: should not be necessary!?

    CONFIG['server_host'] = {
        'scheme': 'http',
        'host': 'example.org',
        'port': '8001',
    }
    # TODO: test with server_prefix

    # add symlink to templates -- XXX: hacky, should not be necessary!?
    templates_path = instance.__file__.split(os.path.sep)[:-2] + ['templates']
    os.symlink(os.path.sep.join(templates_path), 'templates')

    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('example.org', 8001, load_app)
开发者ID:pads,项目名称:tiddlywebplugins.bfw,代码行数:25,代码来源:test_web.py


示例4: setup_module

def setup_module(module):
    make_test_env(module)
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
    wsgi_intercept.add_wsgi_intercept('thing.0.0.0.0', 8080, app_fn)
    module.http = httplib2.Http()
    make_fake_space(store, 'thing')
开发者ID:Erls-Corporation,项目名称:tiddlyspace,代码行数:7,代码来源:test_web_status.py


示例5: setup_module

def setup_module(module):
    try:
        shutil.rmtree('store')
    except:
        pass # !!!
    config['server_host'] = {
            'host': 'our_test_domain',
            'port': '8001',
            'scheme': 'http',
            }
    from tiddlyweb.web import serve
    # we have to have a function that returns the callable,
    # Selector just _is_ the callable
    def app_fn():
        return serve.load_app()
    #wsgi_intercept.debuglevel = 1
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)

    environ = {'tiddlyweb.config': config}
    module.store = Store(config['server_store'][0], config['server_store'][1], environ)

    admin = User('admin')
    admin.add_role('ADMIN')
    admin.set_password('spank')
    module.store.put(admin)
    module.admin_authorization = b64encode('admin:spank')
    module.user_authorization = b64encode('cdent:pigdog')
开发者ID:FND,项目名称:tiddlyspace.old,代码行数:28,代码来源:test_web_user.py


示例6: initialize

    def initialize(self, request, connectors):
        # Install the WSGI interception layer.
        install()

        # Unload django.
        for module in list(sys.modules.keys()):
            if module and 'django' in module:
                del sys.modules[module]

        # Reset and clear all global cache in armet.
        from armet import decorators

        decorators._resources = {}
        # decorators._handlers = {}
        armet.use.config = {}

        # Re-initialize the configuration.
        armet.use(connectors=connectors, debug=True)

        prefix = 'tests.armet.connectors.'
        callback = None
        if 'model' in connectors:
            # Initialize the database access layer.
            model = import_module(prefix + connectors['model'])
            callback = model.model_setup

            # Add the models module so that it can be generically imported.
            sys.modules[prefix + 'models'] = model

        # Initialize the http access layer.
        http = import_module(prefix + connectors['http'])
        http.http_setup(connectors, self.host, self.port, callback=callback)

        # Add a finalizer to teardown the http layer.
        request.addfinalizer(lambda: http.http_teardown(self.host, self.port))
开发者ID:ikebrown,项目名称:python-armet,代码行数:35,代码来源:base.py


示例7: setup_module

def setup_module(module):
    make_test_env(module)
    # we have to have a function that returns the callable,
    # Selector just _is_ the callable
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
    module.http = httplib2.Http()
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:7,代码来源:test_put_hash.py


示例8: initialize_app

def initialize_app():
    app = load_app()
    def app_fn():
        return app

    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)
开发者ID:chancejiang,项目名称:tiddlyweb,代码行数:7,代码来源:fixtures.py


示例9: setup_module

def setup_module(module):
    module.store = Store('ramstore', {}, {})
    config['server_store'] = ['ramstore', {}]
    def app_fn():
        return serve.load_app()
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)
开发者ID:FND,项目名称:tiddlyweb-plugins-1,代码行数:7,代码来源:test_ramstore.py


示例10: setup_module

def setup_module(module):
    try:
        shutil.rmtree('indexdir')
        shutil.rmtree('store')
    except:
        pass
    app = load_app()

    def app_fn(): return app

    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('tankt.peermore.com', 8080, app_fn)

    store = get_store(config)
    test_bag1 = Bag('newtank')

    try:
        store.delete(test_bag1)
    except StoreError:
        pass

    module.environ = {'tiddlyweb.store': store, 'tiddlyweb.config': config}
    module.store = store
    module.http = httplib2.Http()
    module.cookie, module.csrf = establish_user_auth(config, store,
            'tankt.peermore.com:8080', 'tester')
开发者ID:BillSeitz,项目名称:tank,代码行数:26,代码来源:test_forge.py


示例11: setup_module

def setup_module(module):

    module.store = get_store(config)

    # cascade to deal with differently named files depending on 
    # anydbm impelementation
    try:
        os.unlink('links.db')
    except OSError:
        pass  # not there
    module.links_manager = LinksManager()

    try:
        shutil.rmtree('store')
    except:
        pass
    
    def app():
        return serve.load_app()
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app)

    # for @someone syntax to test correctly we need a corresponding
    # recipe
    module.store.put(Bag('cdent_public'))
    recipe = Recipe('cdent_public')
    recipe.set_recipe([('cdent_public', '')])
    module.store.put(recipe)
开发者ID:FND,项目名称:tiddlywebplugins.links,代码行数:28,代码来源:test_tiddler.py


示例12: setup_module

def setup_module(module):
    make_test_env(module)
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
    wsgi_intercept.add_wsgi_intercept('thing.0.0.0.0', 8080, app_fn)
    wsgi_intercept.add_wsgi_intercept('other.0.0.0.0', 8080, app_fn)
    wsgi_intercept.add_wsgi_intercept('foo.0.0.0.0', 8080, app_fn)
开发者ID:dahukanna,项目名称:tiddlyspace,代码行数:7,代码来源:test_web_use_instance.py


示例13: setup_intercept

    def setup_intercept(self, callbacks, intercept_api=False):
        """Setup the WSGI intercepts.

        `callbacks` have to be provided to call upon request of the
        intercepted urls. They should be supplied as a dictionary of
        ((hostname, port), callback).

        Additionally one extra `default` callback has to be passed in,
        in the form ('default', callback).

        The `intercept_api` parameter is used to install the `httplib2`
        intercepts, used to intercept the lazr.restful api calls.
        """
        self.patch_wsgi_intercept()

        self.intercepted = []
        install_opener()

        self.intercept_api = intercept_api
        if intercept_api:
            install()

        for key, callback in callbacks.items():
            if key == 'default':
                continue
            host, port = key
            add_wsgi_intercept(host, port, callback)
            self.intercepted.append((host, port))
开发者ID:miing,项目名称:mci_migo_packages_u1-test-utils,代码行数:28,代码来源:wsgi_intercept.py


示例14: initialize_app

def initialize_app():
    app = load_app()

    def app_fn():
        return app

    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
开发者ID:tiddlyweb,项目名称:tiddlywebplugins.mapuser,代码行数:8,代码来源:fixtures.py


示例15: setup_module

def setup_module(module):
    make_test_env(module)

    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
    wsgi_intercept.add_wsgi_intercept('cdent.0.0.0.0', 8080, app_fn)

    module.http = httplib2.Http()
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:8,代码来源:test_user.py


示例16: setup_module

def setup_module(module):
    # we have to have a function that returns the callable,
    # Selector just _is_ the callable
    def app_fn():
        return serve.load_app()
    #wsgi_intercept.debuglevel = 1
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('our_test_domain', 8001, app_fn)
开发者ID:djswagerman,项目名称:tiddlyweb,代码行数:8,代码来源:test_web.py


示例17: setup_module

def setup_module(module):
    make_test_env(module)
    # we have to have a function that returns the callable,
    # Selector just _is_ the callable
    make_fake_space(module.store, 'cdent')
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
    wsgi_intercept.add_wsgi_intercept('cdent.0.0.0.0', 8080, app_fn)
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:8,代码来源:test_friendly_uri.py


示例18: setUp

 def setUp(self):
     super(BaseComplianceCase, self).setUp()
     warnings.simplefilter("error")
     self.addCleanup(warnings.resetwarnings)
     # Intercept httplib2 requests
     from wsgi_intercept.httplib2_intercept import install, uninstall
     install()
     self.addCleanup(uninstall)
开发者ID:pumazi,项目名称:wsgi_intercept2,代码行数:8,代码来源:test_wsgi_compliance.py


示例19: setup_module

def setup_module(module):
    global TESTS
    make_test_env(module)
    httplib2_intercept.install()
    wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)

    module.http = httplib2.Http()
    TESTS = yaml.load(open('../test/httptest.yaml'))
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:8,代码来源:test_web_http_api.py


示例20: __init__

    def __init__(self, *args, **kwargs):
        wsgiapp = loadapp('config:test.ini', relative_to=conf_dir)
        self.app = wsgiapp
        from twirlip.lib.notification import notification_methods
        notification_methods['Email'] = mock_email

        httplib2_intercept.install()
        add_wsgi_intercept('testserver.example.com', 80, TwirlipServerFixture)
        TestCase.__init__(self, *args, **kwargs)
开发者ID:socialplanning,项目名称:Twirlip,代码行数:9,代码来源:__init__.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.getModuleLogger函数代码示例发布时间:2022-05-26
下一篇:
Python wsgi_intercept.remove_wsgi_intercept函数代码示例发布时间: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