Fix urllib.urlopen for python3
Current code is broken on python3. We need to use urllib.request to use urlopen(). Change-Id: I9f64c22311102c7a67d49b211be91d62b3170a47
This commit is contained in:
parent
1022a8cca5
commit
50bea70bb5
|
@ -21,7 +21,7 @@ import os
|
|||
import shutil
|
||||
import tarfile
|
||||
import tempfile
|
||||
import urllib
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ def _download_file(url, dest_dir, dest_filename):
|
|||
"""download a given url to a given destination directory and
|
||||
destination filenamee"""
|
||||
filename = os.path.join(dest_dir, dest_filename)
|
||||
with closing(urllib.urlopen(url)) as response: # nosec
|
||||
with closing(urllib.request.urlopen(url)) as response: # nosec
|
||||
with open(filename, 'wb') as f:
|
||||
while True:
|
||||
buf = response.read(8192)
|
||||
|
|
Loading…
Reference in New Issue