circuits.web.url module

This is a module for dealing with urls. In particular, sanitizing them.

class circuits.web.url.URL(scheme, host, port, path, params='', query='', fragment='')

Bases: object

For more information on how and what we parse / sanitize:
http://tools.ietf.org/html/rfc1808.html
The more up-to-date RFC is this one:
http://www.ietf.org/rfc/rfc3986.txt
absolute()

Return True if this is a fully-qualified URL with a hostname and everything

abspath()

Clear out any ‘..’ and excessive slashes from the path

canonical()

Canonicalize this url. This includes reordering parameters and args to have a consistent ordering

defrag()

Remove the fragment from this url

deparam(params=None)

Strip any of the provided parameters out of the url

encode(encoding)

Return the url in an arbitrary encoding

equiv(other)

Return true if this url is equivalent to another

escape()

Make sure that the path is correctly escaped

lower()

Lowercase the hostname

classmethod parse(url, encoding)

Parse the provided url, and return a URL instance

punycode()

Convert to punycode hostname

relative(path, encoding='utf-8')

Evaluate the new path relative to the current url

sanitize()

A shortcut to abspath, escape and lowercase

unescape()

Unescape the path

unicode()

Return a unicode version of this url

unpunycode()

Convert to an unpunycoded hostname

utf8()

Return a utf-8 version of this url

circuits.web.url.parse_url(url, encoding='utf-8')

Parse the provided url string and return an URL object