Add workaround for old requests in kojiwrapper
When running with requests<2.18 (i.e. on RHEL 7), streaming responses
are not a context manager and need to be wrapped in contextlib.closing.
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit 860360629d
)
This commit is contained in:
parent
34fcd550b6
commit
27d055992e
@ -999,7 +999,8 @@ class KojiDownloadProxy:
|
||||
:param str dest: file path to store the result in
|
||||
:returns: path to the downloaded file (same as dest) or None if the URL
|
||||
"""
|
||||
with self.session.get(url, stream=True) as r:
|
||||
# contextlib.closing is only needed in requests<2.18
|
||||
with contextlib.closing(self.session.get(url, stream=True)) as r:
|
||||
if r.status_code == 404:
|
||||
self.logger.warning("GET %s NOT FOUND", url)
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user