def netloc(self, netloc):
if '@' in netloc:
auth, host = netloc.split('@', 1)
else:
auth, host = None, netloc
port = ''
if host and host[0] == '[':
host, port = host[1:].split(']', 1)
if ':' in port:
_host, port = port.split(':', 1)
if not host:
host = _host
elif ':' in host:
host, port = host.split(':', 1)
if '%' in port:
port = unquote(port)
if port:
port = int(port)
if host:
host = unquote_plus(host)
self.auth = auth # TODO: roll back changes if it fails
self.host = host
self.port = port
评论列表
文章目录