How to use the ural.utils.urlunsplit function in ural

To help you get started, we’ve selected a few ural examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github medialab / ural / ural / normalize_url.py View on Github external
result = SplitResult(
        scheme,
        netloc.lower(),
        path,
        query,
        fragment
    )

    if not unsplit:
        return result

    # TODO: check if works with `unsplit=False`
    if strip_protocol or not has_protocol:
        result = urlunsplit(result)[2:]
    else:
        result = urlunsplit(result)

    return result
github medialab / ural / ural / normalize_url.py View on Github external
# Result
    result = SplitResult(
        scheme,
        netloc.lower(),
        path,
        query,
        fragment
    )

    if not unsplit:
        return result

    # TODO: check if works with `unsplit=False`
    if strip_protocol or not has_protocol:
        result = urlunsplit(result)[2:]
    else:
        result = urlunsplit(result)

    return result
github medialab / ural / ural / facebook.py View on Github external
scheme, netloc, path, query, fragment = urlsplit(safe_url)

    if 'facebook' not in netloc:
        raise Exception('ural.facebook.convert_facebook_url_to_mobile: %s is not a facebook url' % url)

    netloc = re.sub(MOBILE_REPLACE_RE, 'm.facebook.', netloc)

    result = (
        scheme,
        netloc,
        path,
        query,
        fragment
    )

    result = urlunsplit(result)

    if not has_protocol:
        result = result.split('://', 1)[-1]

    return result
github medialab / ural / ural / lru / __init__.py View on Github external
t = stems_index.get('t')

    if t is not None:
        netloc += ':' + t

    p = stems_index.get('p')

    path = ''

    if p is not None:
        path = '/' + p

    query = stems_index.get('q', '')
    fragment = stems_index.get('f', '')

    return urlunsplit((scheme, netloc, path, query, fragment))