From 9a292bc792f931f987a41163612f0dd7874675d2 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Wed, 3 Jan 2024 11:58:54 +0000 Subject: [PATCH] CI : Fix Arnold download authentication `realm = None` doesn't work unless you're using the HTTPPasswordMgrWithDefaultRealm class instead of the HTTPPasswordMgr class. Obviously. --- .github/workflows/main/installArnold.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main/installArnold.py b/.github/workflows/main/installArnold.py index 5bab1d0c640..bbcc89da07d 100755 --- a/.github/workflows/main/installArnold.py +++ b/.github/workflows/main/installArnold.py @@ -68,16 +68,18 @@ print( "Downloading Arnold \"{}\"".format( url ) ) -authHandler = urllib.request.HTTPBasicAuthHandler() -authHandler.add_password( +passwordManager = urllib.request.HTTPPasswordMgrWithDefaultRealm() +passwordManager.add_password( realm = None, uri = url, user = os.environ["ARNOLD_DOWNLOAD_USER"], passwd = os.environ["ARNOLD_DOWNLOAD_PASSWORD"] ) -urllib.request.install_opener( urllib.request.build_opener( authHandler ) ) -with urllib.request.urlopen( url ) as inFile : +authHandler = urllib.request.HTTPBasicAuthHandler( passwordManager ) +opener = urllib.request.build_opener( authHandler ) + +with opener.open( url ) as inFile : with open( archiveFile, "wb" ) as outFile : shutil.copyfileobj( inFile, outFile )