mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
added context as an argument for downloading
This commit is contained in:
parent
7ff5647a53
commit
e554ef9c6d
1 changed files with 4 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue