Always use stream=True when iterating over a request

Fixes https://pagure.io/releng/issue/9226
This commit is contained in:
Miro Hrončok 2020-02-05 17:59:25 +01:00 committed by Tomas Kopecek
parent 5ad52611c1
commit 388bb070f1
2 changed files with 2 additions and 2 deletions

View file

@ -1677,7 +1677,7 @@ def openRemoteFile(relpath, topurl=None, topdir=None, tempdir=None):
url = "%s/%s" % (topurl, relpath)
fo = tempfile.TemporaryFile(dir=tempdir)
try:
resp = requests.get(url)
resp = requests.get(url, stream=True)
for chunk in resp.iter_content(chunk_size=8192):
fo.write(chunk)
finally:

View file

@ -479,7 +479,7 @@ class BaseTaskHandler(object):
self.logger.debug("Downloading %s", relpath)
url = "%s/%s" % (self.options.topurl, relpath)
try:
resp = requests.get(url)
resp = requests.get(url, stream=True)
if not os.path.exists(os.path.dirname(fn)):
os.makedirs(os.path.dirname(fn))
with open(fn, 'wb') as fdst: