#1993 Always use stream=True when iterating over a request
Merged 2 years ago by tkopecek. Opened 2 years ago by churchyard.
churchyard/koji requests_stream  into  master

file modified
+1 -1
@@ -1677,7 +1677,7 @@ 

          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:

file modified
+1 -1
@@ -479,7 +479,7 @@ 

              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:

Note that it should be possible to use shutil.copyfileobj instead of iterating over chunks, however I wanted to make this fix as self contained as possible.

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rebased onto 2c2c5b3

2 years ago

Commit 6aa1b3e fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago

@tkopecek Could you please hotfix deploy this?

No, I've no access to Fedora's instance. Please, file a ticket to https://pagure.io/fedora-infrastructure/

Reopening https://pagure.io/releng/issue/9226 shoudl work. It got closed even if it was in other project.

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago