def __init__(self, proxy): url = urlparse.urlparse(proxy) if url.scheme and url.scheme in ('http', 'socks5') and url.hostname: self.proxy = create_proxy(url.hostname, url.port or 1080, username=url.username, password=url.password, type=url.scheme.upper()) else: _raise_proxy_error('Invalid proxy URL format.')
def __init__(self, proxy): url = urlparse(proxy) if url.scheme and url.scheme in ('http', 'socks5') and url.hostname: self.proxy = create_proxy( url.hostname, url.port or 1080, username=url.username, password=url.password, type=url.scheme.upper() ) else: _raise_proxy_error('Invalid proxy URL format.')
def set_proxy(self, host, port, username=None, password=None, type='HTTP'): proxy = create_proxy(host, port, username, password, type) self.request.custom_proxy = proxy
def _get_custom_proxy_list(self): return [ create_proxy(host, port, username, password, type) for host, port, username, password, type in self.proxy_list ]
def _get_custom_proxy_list(self): return [ create_proxy(host, port, username, password, type) for host, port, username, password,type in self.proxy_list ]
def _customProxyList(self): return [ create_proxy(host, port, username, password) for host, port, username, password in self.proxy_list ]