def __init__( self, reactor, proxy_reactor=None, contextFactory=BrowserLikePolicyForHTTPS(), connectTimeout=None, bindAddress=None, pool=None, http_proxy=None, https_proxy=None, ): _AgentBase.__init__(self, reactor, pool) if proxy_reactor is None: self.proxy_reactor = reactor else: self.proxy_reactor = proxy_reactor self._endpoint_kwargs = {} if connectTimeout is not None: self._endpoint_kwargs["timeout"] = connectTimeout if bindAddress is not None: self._endpoint_kwargs["bindAddress"] = bindAddress self.http_proxy_endpoint = _http_proxy_endpoint( http_proxy, self.proxy_reactor, **self._endpoint_kwargs) self.https_proxy_endpoint = _http_proxy_endpoint( https_proxy, self.proxy_reactor, **self._endpoint_kwargs) self._policy_for_https = contextFactory self._reactor = reactor
def __init__( self, reactor, contextFactory=BrowserLikePolicyForHTTPS(), connectTimeout=None, bindAddress=None, pool=None, proxy_url_str: Optional[str] = None, ): _AgentBase.__init__(self, reactor, pool) self._endpoint_kwargs = {} if connectTimeout is not None: self._endpoint_kwargs["timeout"] = connectTimeout if bindAddress is not None: self._endpoint_kwargs["bindAddress"] = bindAddress if proxy_url_str is not None: parsed_url = decompose_http_proxy_url(proxy_url_str) self._proxy_auth = parsed_url.credentials self.proxy_endpoint = HostnameEndpoint(reactor, parsed_url.hostname, parsed_url.port, **self._endpoint_kwargs) else: self.proxy_endpoint = None self._policy_for_https = contextFactory self._reactor = reactor
def __init__( self, reactor, proxy_reactor=None, contextFactory: Optional[IPolicyForHTTPS] = None, connectTimeout=None, bindAddress=None, pool=None, use_proxy=False, ): contextFactory = contextFactory or BrowserLikePolicyForHTTPS() _AgentBase.__init__(self, reactor, pool) if proxy_reactor is None: self.proxy_reactor = reactor else: self.proxy_reactor = proxy_reactor self._endpoint_kwargs = {} if connectTimeout is not None: self._endpoint_kwargs["timeout"] = connectTimeout if bindAddress is not None: self._endpoint_kwargs["bindAddress"] = bindAddress http_proxy = None https_proxy = None no_proxy = None if use_proxy: proxies = getproxies_environment() http_proxy = proxies["http"].encode( ) if "http" in proxies else None https_proxy = proxies["https"].encode( ) if "https" in proxies else None no_proxy = proxies["no"] if "no" in proxies else None # Parse credentials from https proxy connection string if present self.https_proxy_creds, https_proxy = parse_username_password( https_proxy) self.http_proxy_endpoint = http_proxy_endpoint(http_proxy, self.proxy_reactor, **self._endpoint_kwargs) self.https_proxy_endpoint = http_proxy_endpoint( https_proxy, self.proxy_reactor, **self._endpoint_kwargs) self.no_proxy = no_proxy self._policy_for_https = contextFactory self._reactor = reactor
def __init__( self, reactor: IReactorCore, proxy_reactor: Optional[ISynapseReactor] = None, contextFactory: Optional[IPolicyForHTTPS] = None, connectTimeout: Optional[float] = None, bindAddress: Optional[bytes] = None, pool: Optional[HTTPConnectionPool] = None, use_proxy: bool = False, ): contextFactory = contextFactory or BrowserLikePolicyForHTTPS() _AgentBase.__init__(self, reactor, pool) if proxy_reactor is None: self.proxy_reactor = reactor else: self.proxy_reactor = proxy_reactor self._endpoint_kwargs: Dict[str, Any] = {} if connectTimeout is not None: self._endpoint_kwargs["timeout"] = connectTimeout if bindAddress is not None: self._endpoint_kwargs["bindAddress"] = bindAddress http_proxy = None https_proxy = None no_proxy = None if use_proxy: proxies = getproxies_environment() http_proxy = proxies["http"].encode( ) if "http" in proxies else None https_proxy = proxies["https"].encode( ) if "https" in proxies else None no_proxy = proxies["no"] if "no" in proxies else None self.http_proxy_endpoint, self.http_proxy_creds = http_proxy_endpoint( http_proxy, self.proxy_reactor, contextFactory, **self._endpoint_kwargs) self.https_proxy_endpoint, self.https_proxy_creds = http_proxy_endpoint( https_proxy, self.proxy_reactor, contextFactory, **self._endpoint_kwargs) self.no_proxy = no_proxy self._policy_for_https = contextFactory self._reactor = reactor
def __init__( self, reactor, proxy_reactor=None, contextFactory=BrowserLikePolicyForHTTPS(), connectTimeout=None, bindAddress=None, pool=None, use_proxy=False, ): _AgentBase.__init__(self, reactor, pool) if proxy_reactor is None: self.proxy_reactor = reactor else: self.proxy_reactor = proxy_reactor self._endpoint_kwargs = {} if connectTimeout is not None: self._endpoint_kwargs["timeout"] = connectTimeout if bindAddress is not None: self._endpoint_kwargs["bindAddress"] = bindAddress http_proxy = None https_proxy = None no_proxy = None if use_proxy: proxies = getproxies_environment() http_proxy = proxies["http"].encode( ) if "http" in proxies else None https_proxy = proxies["https"].encode( ) if "https" in proxies else None no_proxy = proxies["no"] if "no" in proxies else None self.http_proxy_endpoint = _http_proxy_endpoint( http_proxy, self.proxy_reactor, **self._endpoint_kwargs) self.https_proxy_endpoint = _http_proxy_endpoint( https_proxy, self.proxy_reactor, **self._endpoint_kwargs) self.no_proxy = no_proxy self._policy_for_https = contextFactory self._reactor = reactor
def __init__(self, reactor, pool=None): _AgentBase.__init__(self, reactor, pool)