How to use the treq.api.default_reactor function in treq

To help you get started, we’ve selected a few treq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mochi / vor / vor / elasticsearch.py View on Github external
def _noVerifyAgent( *args, **kwargs ):
    """Agent that suppresses TLS verification

    treq.get(..., agent=_noVerifyAgent())

    Returns the same agent every time...
    """
    if getattr(_noVerifyAgent, 'agent',None) is None:
        from treq import api
        reactor = api.default_reactor(kwargs.get('reactor'))
        pool = api.default_pool(reactor,
                            kwargs.get('pool'),
                            kwargs.get('persistent'))
        _noVerifyAgent.agent = api.Agent(
            reactor,
            contextFactory=_NoVerifyContextFactory(),
            pool=pool
        )
    return _noVerifyAgent.agent
github CPChain / pdash / cpchain / proxy / ssl_cert.py View on Github external
def no_verify_agent(**kwargs):
    reactor = treq.api.default_reactor(kwargs.get('reactor'))
    pool = treq.api.default_pool(
        reactor,
        kwargs.get('pool'),
        kwargs.get('persistent'))

    no_verify_agent.agent = treq.api.Agent(
        reactor,
        contextFactory=NoVerifySSLContextFactory(),
        pool=pool
    )
    return no_verify_agent.agent