From e554ef9c6d885da1c6f79e2a85d4f298c52bc28c Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 12 Feb 2019 14:24:20 +0000 Subject: [PATCH] added context as an argument for downloading --- openmc/_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openmc/_utils.py b/openmc/_utils.py index d16f556231..4a2f548f6a 100644 --- a/openmc/_utils.py +++ b/openmc/_utils.py @@ -7,7 +7,7 @@ from urllib.request import urlopen _BLOCK_SIZE = 16384 -def download(url, checksum=None): +def download(url, checksum=None, context=None): """Download file from a URL Parameters @@ -16,6 +16,8 @@ def download(url, checksum=None): URL from which to download checksum : str or None MD5 checksum to check against + context : ssl.SSLContext instance or None + For example ssl._create_unverified_context() Returns ------- @@ -23,7 +25,7 @@ def download(url, checksum=None): Name of file written locally """ - req = urlopen(url) + req = urlopen(url, context=context) # Get file size from header file_size = req.length