def get_html(self, url):
    if self.useproxy:
        self.proxyhandler.validate_proxy()
    req = urllib.request.Request(url, None, data.headers)
    tries = 0
    while ((self.retries == None) or (tries < self.retries)):
        try:
            res = urllib.request.urlopen(req)
            src = res.read()
            break
        except urllib.error.HTTPError as e:
            if self.useproxy:
                self.update_proxy()
            if (e.code != 503):
                bcolors.printFail((('[-]HTTP Error ' + str(e)) + ' was raised!'))
                return None
            if self.useproxy:
                self.proxyhandler.blacklist_current_proxy(True)
        tries += 1
    return html.fromstring(str(src))
def get_html(self, url):
    if self.useproxy:
        self.proxyhandler.validate_proxy()
    req = urllib.request.Request(url, None, data.headers)
    tries = 0
    while ((self.retries == None) or (tries < self.retries)):
        try:
            res = urllib.request.urlopen(req)
            src = res.read()
            break
        except urllib.error.HTTPError as e:
            if self.useproxy:
                self.update_proxy()
            if (e.code != 503):
                bcolors.printFail((('[-]HTTP Error ' + str(e)) + ' was raised!'))
                return None
            if self.useproxy:
                self.proxyhandler.blacklist_current_proxy(True)
        tries += 1
    return html.fromstring(str(src))