PR#1993: Always use stream=True when iterating over a request

Merges #1993
https://pagure.io/koji/pull-request/1993

Fixes: https://pagure.io/koji/issue/1996
This commit is contained in:
Tomas Kopecek 2020-02-12 10:42:18 +01:00
commit 6aa1b3e818
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: