(self, host)
Raises: ValueError on invalid host or malformed IPv6 address.
Raises: ValueError on invalid host or malformed IPv6 address.
Raises : ValueError on invalid host or malformed IPv6 address .
def host(self, host):
        """
        Raises: ValueError on invalid host or malformed IPv6 address.
        """
        # Invalid IPv6 literal.
        urllib.parse.urlsplit('http://%s/' % host)  # Raises ValueError.

        # Invalid host string.
        resembles_ipv6_literal = (
            host is not None and lget(host, 0) == '[' and ':' in host and
            lget(host, -1) == ']')
        if (host is not None and not resembles_ipv6_literal and
           not is_valid_host(host)):
            errmsg = (
                "Invalid host '%s'. Host strings must have at least one "
                "non-period character, can't contain any of '%s', and can't "
                "have adjacent periods.")
            raise ValueError(errmsg % (host, INVALID_HOST_CHARS))

        if callable_attr(host, 'lower'):
            host = host.lower()
        if callable_attr(host, 'startswith') and host.startswith('xn--'):
            host = idna_decode(host)
        self._host = host
def host ( self , host ) : # Invalid IPv6 literal. urllib . parse . urlsplit ( 'http://%s/' % host ) # Raises ValueError. # Invalid host string. resembles_ipv6_literal = ( host is not None and lget ( host , 0 ) == '[' and ':' in host and lget ( host , - 1 ) == ']' ) if ( host is not None and not resembles_ipv6_literal and not is_valid_host ( host ) ) : errmsg = ( "Invalid host '%s'. Host strings must have at least one " "non-period character, can't contain any of '%s', and can't " "have adjacent periods." ) raise ValueError ( errmsg % ( host , INVALID_HOST_CHARS ) ) if callable_attr ( host , 'lower' ) : host = host . lower ( ) if callable_attr ( host , 'startswith' ) and host . startswith ( 'xn--' ) : host = idna_decode ( host ) self . _host = host