당신이 urlunparse
에 전달하는 data
튜플은 다음과 같은 구성 요소가
scheme, netloc, url, query, fragment = data
이 더 netloc
없는, 그리고 scheme
이 uses_netloc
하지 않을 경우, URL이
url = scheme + ':' + url
인을 길 urlunparse (urlunsplit 전화) is defined :
def urlunsplit(data):
...
scheme, netloc, url, query, fragment = data
if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
if url and url[:1] != '/': url = '/' + url
url = '//' + (netloc or '') + url
if scheme:
url = scheme + ':' + url
주 'ssh'
그게 uses_netloc
에없는 :
uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
'imap', 'wais', 'file', 'mms', 'https', 'shttp',
'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
'svn', 'svn+ssh', 'sftp','nfs','git', 'git+ssh']
당신은 당신이 netloc
공급하는 경우 ssh://
로 시작하는 URL을받을 수 있나요 :
In [140]: urlparse.urlunparse(('ssh','netloc','test_path', None, None, None))
Out[140]: 'ssh://netloc/test_path'
urlparse 소스 코드를 적어도 2.6에서 "ssh"가 누락되었습니다. – hd1