def __init__(self, uuid, token, cert_file): self._uuid = uuid self._token = None self._creds = None self.set_token(token) # pin this agent with the platform TLS certificate factory = get_compatible_ssl_context_factory(cert_file) Agent.__init__(self, reactor, contextFactory=factory)
def __init__(self, uuid, token, cert_file, throttling=False): self._uuid = uuid self._token = None self._creds = None self.set_token(token) factory = getPolicyForHTTPS(cert_file) pool = self._get_pool() _Agent.__init__(self, reactor, contextFactory=factory, pool=pool)
def __init__(self, reactor, contextFactory=WebClientContextFactory(), connectTimeout=None, bindAddress=None): Agent.__init__(self, reactor, contextFactory) self._connectTimeout = connectTimeout self._bindAddress = bindAddress
def __init__(self, reactor, connectTimeout=None, bindAddress=None, pool=None, torSocksHostname=None, torSocksPort=None, isolationMode=None): """ Create a L{TorAgent}. @param reactor: A provider of L{twisted.internet.interfaces.IReactorTCP} to place outgoing connections. @type reactor: L{twisted.internet.interfaces.IReactorTCP}. @param connectTimeout: The amount of time that this L{Agent} will wait for the peer to accept a connection. @type connectTimeout: L{float} @param bindAddress: The local address for client sockets to bind to. @type bindAddress: L{bytes} @param pool: An L{HTTPConnectionPool} instance, or C{None}, in which case a non-persistent L{HTTPConnectionPool} instance will be created. @type pool: L{HTTPConnectionPool} @param torSocksHostname: A C{str} giving the tor SOCKS hostname that this TorAgent will use for outbound Tor connections. @param torSocksPort: An C{int} giving the SOCKS port number that will be used for outbound Tor connections. @param isolationMode: A Tor circuit isolation mode: - monoCircuit means always let tor process decide which circuit to use - circuitPerAgent means always use one tor circuit per agent instance """ Agent.__init__(self, reactor, connectTimeout=None, bindAddress=None, pool=None) self._connectTimeout = connectTimeout self._bindAddress = bindAddress self.torSocksHostname = torSocksHostname self.torSocksPort = torSocksPort if isolationMode in self.isolationModes: self.isolationMode = isolationMode if isolationMode == 'circuitPerAgent': self.username, self.password = self._genRandomUserPass() else: raise TorAgentCircuitIsolationModeNotSupported( "Unsupported mode: %r" % (isolationMode, ))
def __init__(self, uuid, token, cert_file): self._uuid = uuid self._token = None self._creds = None self.set_token(token) # pin this agent with the platform TLS certificate factory = getPolicyForHTTPS(cert_file) persistent = os.environ.get('SOLEDAD_HTTP_PERSIST', None) pool = HTTPConnectionPool(reactor, persistent=bool(persistent)) Agent.__init__(self, reactor, contextFactory=factory, pool=pool)
def __init__(self, gerrit_host, *args, **kwargs): url_parts = urlparse.urlparse(gerrit_host) if url_parts.scheme: self.gerrit_protocol = url_parts.scheme self.gerrit_host = url_parts.netloc auth_entry = NETRC.authenticators(self.gerrit_host.partition(':')[0]) if auth_entry: self.auth_token = 'Basic %s' % (base64.b64encode( '%s:%s' % (auth_entry[0], auth_entry[2]))) else: self.auth_token = None Agent.__init__(self, reactor, *args, **kwargs)
def __init__(self, gerrit_host, *args, **kwargs): url_parts = urlparse.urlparse(gerrit_host) if url_parts.scheme: self.gerrit_protocol = url_parts.scheme self.gerrit_host = url_parts.netloc auth_entry = NETRC.authenticators(self.gerrit_host.partition(':')[0]) if auth_entry: self.auth_token = 'Basic %s' % ( base64.b64encode('%s:%s' % (auth_entry[0], auth_entry[2]))) else: self.auth_token = None Agent.__init__(self, reactor, *args, **kwargs)
def __init__(self, reactor, connectTimeout=None, bindAddress=None, pool=None, torSocksHostname=None, torSocksPort=None, isolationMode=None): """ Create a L{TorAgent}. @param reactor: A provider of L{twisted.internet.interfaces.IReactorTCP} to place outgoing connections. @type reactor: L{twisted.internet.interfaces.IReactorTCP}. @param connectTimeout: The amount of time that this L{Agent} will wait for the peer to accept a connection. @type connectTimeout: L{float} @param bindAddress: The local address for client sockets to bind to. @type bindAddress: L{bytes} @param pool: An L{HTTPConnectionPool} instance, or C{None}, in which case a non-persistent L{HTTPConnectionPool} instance will be created. @type pool: L{HTTPConnectionPool} @param torSocksHostname: A C{str} giving the tor SOCKS hostname that this TorAgent will use for outbound Tor connections. @param torSocksPort: An C{int} giving the SOCKS port number that will be used for outbound Tor connections. @param isolationMode: A Tor circuit isolation mode: - monoCircuit means always let tor process decide which circuit to use - circuitPerAgent means always use one tor circuit per agent instance """ Agent.__init__(self, reactor,connectTimeout=None, bindAddress=None, pool=None) self._connectTimeout = connectTimeout self._bindAddress = bindAddress self.torSocksHostname = torSocksHostname self.torSocksPort = torSocksPort if isolationMode in self.isolationModes: self.isolationMode = isolationMode if isolationMode == 'circuitPerAgent': self.username, self.password = self._genRandomUserPass() else: raise TorAgentCircuitIsolationModeNotSupported("Unsupported mode: %r" % (isolationMode,))
def __init__(self, *args, **kwargs): Agent.__init__(self, *args, **kwargs)
def __init__(self, reactor, path, **kwargs): self.path = path Agent.__init__(self, reactor, **kwargs)
def __init__(self, reactor, contextFactory = WebClientContextFactory(), connectTimeout = None, bindAddress = None): Agent.__init__(self, reactor, contextFactory) self._connectTimeout = connectTimeout self._bindAddress = bindAddress
def __init__(self, react, path, **kwargs): Agent.__init__(self, react, **kwargs) self.path = path