mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge pull request #1163 from Shimwell/utils_scripts_download_update
added context as an argument for downloading
This commit is contained in:
commit
b8e69692d4
1 changed files with 3 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ from urllib.request import urlopen
|
|||
_BLOCK_SIZE = 16384
|
||||
|
||||
|
||||
def download(url, checksum=None):
|
||||
def download(url, checksum=None, **kwargs):
|
||||
"""Download file from a URL
|
||||
|
||||
Parameters
|
||||
|
|
@ -16,6 +16,7 @@ def download(url, checksum=None):
|
|||
URL from which to download
|
||||
checksum : str or None
|
||||
MD5 checksum to check against
|
||||
Keyword arguments passed to :func:urllib.request.urlopen
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -23,8 +24,7 @@ def download(url, checksum=None):
|
|||
Name of file written locally
|
||||
|
||||
"""
|
||||
req = urlopen(url)
|
||||
|
||||
req = urlopen(url, **kwargs)
|
||||
# Get file size from header
|
||||
file_size = req.length
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue