billboards, URLs are so common, that it's easy to overlook their complexity and power. With hyperlink's :class:`URL` type, working with URLs doesn't have to be hard. URLs are made of many parts. Most of these parts are officially named in `RFC 3986`_ and this diagram may prove handy in identifying them:: foo://user:pass@example.com:8042/over/there?name=ferret#nose \_/ \_______/ \_________/ \__/\_________/ \_________/ \__/ | | | | | | | scheme userinfo host port path query fragment While :meth:`~URL.from_text` is used for parsing whole URLs, the :class:`URL` constructor builds a URL from the individual components, like so:: >>> from hyperlink import URL >>> url = URL(scheme=u'https', host=u'example.com', path=[u'hello', u'world']) >>> print(url.to_text()) https://example.com/hello/world The constructor runs basic type checks. All strings are expected to be decoded (:class:`unicode` in Python 2). All arguments are optional, defaulting to appropriately empty values. A full list of constructor arguments is below. Args: scheme (unicode): The text name of the scheme. host (unicode): The host portion of the network location port (int): The port part of the network location. If ``None`` or no port is passed, the port will default to the default port of the scheme, if it is known. See the ``SCHEME_PORT_MAP`` and :func:`register_default_port` for more info. path (tuple): A tuple of strings representing the slash-separated parts of the path. query (tuple): The query parameters, as a dictionary or as an iterable of key-value pairs. fragment (unicode): The fragment part of the URL. rooted (bool): Whether or not the path begins with a slash. userinfo (unicode): The username or colon-separated username:password pair. uses_netloc (bool): Indicates whether two slashes appear between the scheme and the host (``http://eg.com`` vs ``mailto:e@g.com``). Set automatically based on scheme. All of these parts are also exposed as read-only attributes of URL instances, along with several useful methods. .. _RFC 3986: https://tools.ietf.org/html/rfc3986 .. _RFC 3987: https://tools.ietf.org/html/rfc3987 Nr