Skip to content

Commit

Permalink
CI : Fix Arnold download authentication
Browse files Browse the repository at this point in the history
`realm = None` doesn't work unless you're using the HTTPPasswordMgrWithDefaultRealm class instead of the HTTPPasswordMgr class. Obviously.
  • Loading branch information
johnhaddon committed Jan 3, 2024
1 parent 4777134 commit 9a292bc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/main/installArnold.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down

0 comments on commit 9a292bc

Please sign in to comment.