(self, uri, default_port=True)
return authority, path
Accept authority or URI and extract only the authority and path.
Accept authority or URI and extract only the authority and path.
Accept authority or URI and extract only the authority and path .
def reduce_uri(self, uri, default_port=True):
        """Accept authority or URI and extract only the authority and path."""
        # note HTTP URLs do not have a userinfo component
        parts = urlsplit(uri)
        if parts[1]:
            # URI
            scheme = parts[0]
            authority = parts[1]
            path = parts[2] or '/'
        else:
            # host or host:port
            scheme = None
            authority = uri
            path = '/'
        host, port = _splitport(authority)
        if default_port and port is None and scheme is not None:
            dport = {"http": 80,
                     "https": 443,
                     }.get(scheme)
            if dport is not None:
                authority = "%s:%d" % (host, dport)
        return authority, path
def reduce_uri ( self , uri , default_port = True ) : # note HTTP URLs do not have a userinfo component parts = urlsplit ( uri ) if parts [ 1 ] : # URI scheme = parts [ 0 ] authority = parts [ 1 ] path = parts [ 2 ] or '/' else : # host or host:port scheme = None authority = uri path = '/' host , port = _splitport ( authority ) if default_port and port is None and scheme is not None : dport = { "http" : 80 , "https" : 443 , } . get ( scheme ) if dport is not None : authority = "%s:%d" % ( host , dport ) return authority , path