summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/wget.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/wget.py')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 696e918030..6d365729e0 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -361,10 +361,11 @@ class Wget(FetchMethod):
361 361
362 try: 362 try:
363 import netrc 363 import netrc
364 n = netrc.netrc() 364 auth_data = netrc.netrc().authenticators(urllib.parse.urlparse(uri).hostname)
365 login, unused, password = n.authenticators(urllib.parse.urlparse(uri).hostname) 365 if auth_data:
366 add_basic_auth("%s:%s" % (login, password), r) 366 login, _, password = auth_data
367 except (TypeError, ImportError, IOError, netrc.NetrcParseError): 367 add_basic_auth("%s:%s" % (login, password), r)
368 except (FileNotFoundError, netrc.NetrcParseError):
368 pass 369 pass
369 370
370 with opener.open(r, timeout=30) as response: 371 with opener.open(r, timeout=30) as response: