'Get the requested URL.
Note that we do not have any concept of timing here - we try to connect
through all proxies as fast as possible until one works. Timing and poll
frequency is left to the calling code.
Args:
url: The URL to fetch
verify_cb: An optional callback which can be used to validate the URL. It
receives the HTTPObject and return True if this seems OK, False
otherwise. For example, if we are behind a captive portal we might
receive invalid object even though HTTP status is 200.
data: Parameters to send in POST bodies (See Requests documentation).
params: Parameters to send in GET URLs (See Requests documentation).
headers: Additional headers (See Requests documentation)
method: The HTTP method to use. If not set we select one automatically.
timeout: See Requests documentation.
Returns:
An HTTPObject instance or None if a connection could not be made.'

def OpenURL(self, url, verify_cb=(lambda x: True), data=None, params=None, headers=None, method='GET', timeout=None):

    tries = 0
    last_error = 500
    while (tries < len(self.proxies)):
        proxy_index = (self.last_proxy_index % len(self.proxies))
        proxy = self.proxies[proxy_index]
        try:
            proxydict = {}
            if proxy:
                proxydict['http'] = proxy
                proxydict['https'] = proxy
            headers = (headers or {}).copy()
            headers['Cache-Control'] = 'no-cache'
            if data:
                method = 'POST'
            (duration, handle) = self._RetryRequest(url=url, data=data, params=params, headers=headers, method=method, timeout=timeout, proxies=proxydict)
            data = handle.content
            result = HTTPObject(url=url, data=data, proxy=proxy, code=200, duration=duration)
            if (not verify_cb(result)):
                raise IOError('Data    not    verified.')
            self.consecutive_connection_errors = 0
            return result
        except requests.RequestException as e:
            if (e.response is not None):
                last_error = e.response.status_code
                if (last_error == 406):
                    self.consecutive_connection_errors = 0
                    return HTTPObject(code=406)
            self.last_proxy_index = (proxy_index + 1)
            tries += 1
        except IOError:
            self.last_proxy_index = (proxy_index + 1)
            tries += 1
            last_error = 500
    return HTTPObject(code=last_error)
