Exemplo n.º 1
0
def urlparse(url):
    """Parse a URL to determine if it is redis-compatible or not."""
    result = _urlparse(url)
    if result.scheme not in SUPPORTED_SCHEMES:
        raise ValueError("URL Scheme {0} not supported by lumberjack.".format(
            result.scheme))
    return result
Exemplo n.º 2
0
def urlparse(url, scheme='', allow_fragments=True):
    """return ParseResult where netloc is populated from path if required, no need to test .netloc anymore"""
    # noinspection PyUnresolvedReferences
    from six.moves.urllib.parse import urlparse as _urlparse, ParseResult
    parsed_url = _urlparse(url, scheme, allow_fragments)
    if '' != parsed_url.netloc:
        return parsed_url
    # fix occasional cases where '' == netloc and its data is in parsed_result.path
    # noinspection PyArgumentList
    fix = ParseResult(scheme=parsed_url.scheme,
                      netloc=parsed_url.path,
                      path=url,
                      params=parsed_url.params,
                      query=parsed_url.query,
                      fragment=parsed_url.fragment)
    return fix
Exemplo n.º 3
0
def urlparse(url):
    """Parse a URL to determine if it is redis-compatible or not."""
    result = _urlparse(url)
    if result.scheme not in SUPPORTED_SCHEMES:
        raise ValueError("URL Scheme {0} not supported by lumberjack.".format(result.scheme))
    return result
Exemplo n.º 4
0
def urlparse(u, *args, **kwargs):
    # python 2.7 compatibility: urlparse does not accept None as url
    return _urlparse(u or '', *args, **kwargs)