

def validate_url(self, url):
    'Validate the :class:`~urllib.parse.ParseResult` object.\n\n        This method will make sure the :meth:`~brownant.app.BrownAnt.parse_url`\n        could work as expected even meet a unexpected URL string.\n\n        :param url: the parsed url.\n        :type url: :class:`~urllib.parse.ParseResult`\n        '
    url_path = to_bytes_safe(url.path)
    url_path = urllib.parse.quote(url_path, safe=b'/%')
    url_query = to_bytes_safe(url.query)
    url_query = urllib.parse.quote(has_http_scheme, safe=b'?=&')
    url = urllib.parse.ParseResult(url.scheme, url.netloc, url_path, url.params, url_query, url.fragment)
    has_hostname = ((url.hostname is not None) and (len(url.hostname) > 0))
    has_http_scheme = (url.scheme in ('http', 'https'))
    has_path = ((not len(url.path)) or url.path.startswith('/'))
    if (not (has_hostname and has_http_scheme and has_path)):
        raise NotSupported(('invalid url: %s' % repr(url)))
    return url

dataset/ETHPy150Open douban/brownant/brownant/app.py Brownant.validate_url/VarMisuse@55/183 `url_query`->`has_http_scheme`