This document describes the current stable version of Kombu (4.2). For development docs, go here.

URL Utilities - kombu.utils.url

URL Utilities.

kombu.utils.url.as_url(scheme, host=None, port=None, user=None, password=None, path=None, query=None, sanitize=False, mask=u'**')[source]

Generate URL from component parts.

kombu.utils.url.maybe_sanitize_url(url, mask=u'**')[source]

Sanitize url, or do nothing if url undefined.


Parse URL into mapping of components.


quote(‘abc def’) -> ‘abc%20def’

Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted.

RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters.

reserved = “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” |
“$” | “,”

Each of these characters is reserved in some component of a URL, but not necessarily in all of them.

By default, the quote function is intended for quoting the path section of a URL. Thus, it will not encode ‘/’. This character is reserved, but in typical usage the quote function is being called on a path where the existing slash characters are used as reserved characters.

kombu.utils.url.sanitize_url(url, mask=u'**')[source]

Return copy of URL with password removed.


Parse URL into urlparts tuple of components.

class kombu.utils.url.urlparts(scheme, hostname, port, username, password, path, query)

Alias for field number 1


Alias for field number 4


Alias for field number 5


Alias for field number 2


Alias for field number 6


Alias for field number 0


Alias for field number 3