use contextlib wrapper for older python-requests
This commit is contained in:
parent
7e2cb6b156
commit
bf0552e6de
4 changed files with 8 additions and 4 deletions
|
|
@ -43,6 +43,7 @@ import pwd
|
|||
import requests
|
||||
import fnmatch
|
||||
from ConfigParser import ConfigParser
|
||||
from contextlib import closing
|
||||
from optparse import OptionParser
|
||||
try:
|
||||
import krbV
|
||||
|
|
@ -676,7 +677,7 @@ class VMExecTask(BaseTaskHandler):
|
|||
else:
|
||||
raise koji.BuildError('unsupported file type: %s' % type)
|
||||
koji.ensuredir(os.path.dirname(localpath))
|
||||
with requests.get(remote_url, stream=True) as response:
|
||||
with closing(requests.get(remote_url, stream=True)) as response:
|
||||
f = open(localpath, 'wb')
|
||||
length = response.headers.get('content-length')
|
||||
if length is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue