(self, url)
return self
Parse and load a URL.

        Raises: ValueError on invalid URL, like a malformed IPv6 address
        or invalid port.
Parse and load a URL.
Parse and load a URL .
def load(self, url):
        """
        Parse and load a URL.

        Raises: ValueError on invalid URL, like a malformed IPv6 address
        or invalid port.
        """
        self.username = self.password = None
        self._host = self._port = self._scheme = None

        if url is None:
            url = ''
        if not isinstance(url, six.string_types):
            url = str(url)

        # urlsplit() raises a ValueError on malformed IPv6 addresses in
        # Python 2.7+.
        tokens = urlsplit(url)

        self.netloc = tokens.netloc  # Raises ValueError in Python 2.7+.
        self.scheme = tokens.scheme
        if not self.port:
            self._port = DEFAULT_PORTS.get(self.scheme)
        self.path.load(tokens.path)
        self.query.load(tokens.query)
        self.fragment.load(tokens.fragment)

        return self
def load ( self , url ) : self . username = self . password = None self . _host = self . _port = self . _scheme = None if url is None : url = '' if not isinstance ( url , six . string_types ) : url = str ( url ) # urlsplit() raises a ValueError on malformed IPv6 addresses in # Python 2.7+. tokens = urlsplit ( url ) self . netloc = tokens . netloc # Raises ValueError in Python 2.7+. self . scheme = tokens . scheme if not self . port : self . _port = DEFAULT_PORTS . get ( self . scheme ) self . path . load ( tokens . path ) self . query . load ( tokens . query ) self . fragment . load ( tokens . fragment ) return self