Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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