From 2c2c5b30f2b341297da92c527bd79f30174d1a00 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Feb 10 2020 09:34:22 +0000 Subject: Always use stream=True when iterating over a request Fixes https://pagure.io/releng/issue/9226 --- diff --git a/koji/__init__.py b/koji/__init__.py index aa4371e..1e7edf0 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -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: diff --git a/koji/tasks.py b/koji/tasks.py index ed18cc0..c4e10c4 100644 --- a/koji/tasks.py +++ b/koji/tasks.py @@ -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: