open

[internal] open a web request, extract html.

Arguments

Source


def open(self, url=None):
    if url != None:
        if not url_checker(url):
            raise ValueError('Url must start with http:// or https://')
        else:
            self._url = url
    else:
        if self._url == None:
            raise ValueError('Url is empty')
    try:
        res = urlopen(self._url)
    except Exception:
        raise Exception('Error connecting at %s' % self._url)
    self._html = res.read().decode(self._decoder)
    res.close()