Skip to content

Commit 16ecaf3

Browse files
committed
fixing bug with download stream --> stream_to
1 parent 29b8f1f commit 16ecaf3

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

examples/singularity_hub/compare_builds.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
shub = Client() # Singularity Hub Client
1414

15+
container_name = 'vsoch/singularity-hello-world'
16+
1517
# Let's keep images in a temporary folder
1618
base = "/home/vanessa/Documents/Work/singularity/hub"
1719
storage = "%s/containers" %base

singularity/hub/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def download_image(manifest,download_folder=None,extract=True,name=None):
6262
print("Found image %s:%s" %(manifest['name'],manifest['branch']))
6363
print("Downloading image... %s" %(image_file))
6464

65-
#TODO: add temporary file here
6665
if download_folder is not None:
6766
image_file = "%s/%s" %(download_folder,image_file)
6867
url = manifest['image']

singularity/hub/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import requests
1212
import os
13+
import tempfile
1314
import sys
1415

1516

@@ -184,7 +185,7 @@ def download_atomically(url,file_name,headers=None):
184185
try: # file_name.tmp.XXXXXX
185186
fd, tmp_file = tempfile.mkstemp(prefix=("%s.tmp." % file_name))
186187
os.close(fd)
187-
response = api_get(url,headers=headers,stream=tmp_file)
188+
response = api_get(url,headers=headers,stream_to=tmp_file)
188189
if isinstance(response, HTTPError):
189190
bot.logger.error("Error downloading %s, exiting.", url)
190191
sys.exit(1)

0 commit comments

Comments
 (0)