Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def acquirer():
return gtoken.TokenAcquirer()
def __init__(self, service_urls=None, user_agent=DEFAULT_USER_AGENT):
self.session = requests.Session()
self.session.headers.update({
'User-Agent': user_agent,
})
self.service_urls = service_urls or ['translate.google.com']
self.token_acquirer = TokenAcquirer(session=self.session, host=self.service_urls[0])
def __init__(self, service_urls=None, user_agent=DEFAULT_USER_AGENT,
proxies=None, timeout=None):
self.session = requests.Session()
if proxies is not None:
self.session.proxies = proxies
self.session.headers.update({
'User-Agent': user_agent,
})
if timeout is not None:
self.session.mount('https://', TimeoutAdapter(timeout))
self.session.mount('http://', TimeoutAdapter(timeout))
self.service_urls = service_urls or ['translate.google.com']
self.token_acquirer = TokenAcquirer(session=self.session, host=self.service_urls[0])
# Use HTTP2 Adapter if hyper is installed
try: # pragma: nocover
from hyper.contrib import HTTP20Adapter
self.session.mount(urls.BASE, HTTP20Adapter())
except ImportError: # pragma: nocover
pass
def __init__(self, service_urls=None, user_agent=DEFAULT_USER_AGENT,
proxies=None, timeout=None):
self.session = requests.Session()
if proxies is not None:
self.session.proxies = proxies
self.session.headers.update({
'User-Agent': user_agent,
})
if timeout is not None:
self.session.mount('https://', TimeoutAdapter(timeout))
self.session.mount('http://', TimeoutAdapter(timeout))
self.service_urls = service_urls or ['translate.google.com']
self.token_acquirer = TokenAcquirer(session=self.session, host=self.service_urls[0])
# Use HTTP2 Adapter if hyper is installed
try: # pragma: nocover
from hyper.contrib import HTTP20Adapter
self.session.mount(urls.BASE, HTTP20Adapter())
except ImportError: # pragma: nocover
pass