# circuits.web.url module

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

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

  Parse the provided url string and return an URL object

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

  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

  classmethod parse(url, encoding)

    Parse the provided url, and return a URL instance

  equiv(other)

    Return true if this url is equivalent to another

  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

  abspath()

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

  lower()

    Lowercase the hostname

  sanitize()

    A shortcut to abspath, escape and lowercase

  escape()

    Make sure that the path is correctly escaped

  unescape()

    Unescape the path

  encode(encoding)

    Return the url in an arbitrary encoding

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

    Evaluate the new path relative to the current url

  punycode()

    Convert to punycode hostname

  unpunycode()

    Convert to an unpunycoded hostname

  absolute()

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

  unicode()

    Return a unicode version of this url

  utf8()

    Return a utf-8 version of this url