126
126
urlparse.uses_netloc.append(protocol)
130
if isinstance(url, unicode):
131
url = url.encode('utf-8')
132
(scheme, netloc, path, params,
133
query, fragment) = urlparse.urlparse(url, allow_fragments=False)
134
username = password = host = port = None
136
username, host = netloc.split('@', 1)
138
username, password = username.split(':', 1)
139
password = urllib.unquote(password)
140
username = urllib.unquote(username)
145
host, port = host.rsplit(':', 1)
149
# TODO: Should this be ConnectionError?
150
raise errors.TransportError('%s: invalid port number' % port)
151
host = urllib.unquote(host)
153
path = urllib.unquote(path)
155
return (scheme, username, password, host, port, path)
129
158
class Transport(object):
130
159
"""This class encapsulates methods for retrieving or putting a file
131
160
from/to a storage location.