replace netloc by hostname when adding trusted-host arg to pip

This commit is contained in:
emmanuel valette
2018-01-11 16:44:16 +01:00
committed by Dan Ryan
parent a94018f837
commit e8253feda4
+2 -2
View File
@@ -439,7 +439,7 @@ def prepare_pip_source_args(sources, pip_args=None):
# Trust the host if it's not verified.
if not sources[0].get('verify_ssl', True):
pip_args.extend(['--trusted-host', urlparse(sources[0]['url']).netloc.split(':')[0]])
pip_args.extend(['--trusted-host', urlparse(sources[0]['url']).hostname])
# Add additional sources as extra indexes.
if len(sources) > 1:
@@ -448,7 +448,7 @@ def prepare_pip_source_args(sources, pip_args=None):
# Trust the host if it's not verified.
if not source.get('verify_ssl', True):
pip_args.extend(['--trusted-host', urlparse(source['url']).netloc.split(':')[0]])
pip_args.extend(['--trusted-host', urlparse(source['url']).hostname])
return pip_args