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
2
cli/koji
2
cli/koji
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# coding=utf-8
|
||||
|
||||
# command line interface for the Koji build system
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import socket
|
|||
import string
|
||||
import sys
|
||||
import time
|
||||
from contextlib import closing
|
||||
from six.moves import range
|
||||
|
||||
try:
|
||||
|
|
@ -488,7 +489,8 @@ def download_file(url, relpath, quiet=False, noprogress=False, size=None, num=No
|
|||
else:
|
||||
print(_("Downloading: %s") % relpath)
|
||||
|
||||
with requests.get(url, stream=True) as response:
|
||||
|
||||
with closing(requests.get(url, stream=True)) as response:
|
||||
length = response.headers.get('content-length')
|
||||
f = open(relpath, 'wb')
|
||||
if length is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue