Merge pull request #17247 from rallytime/bp-17188

Backport #17188 to 2014.7
This commit is contained in:
Thomas S Hatch 2014-11-06 16:58:06 -07:00
commit 1845145c19

View File

@ -590,7 +590,12 @@ class Client(object):
else:
fixed_url = url
try:
response = requests.get(fixed_url, stream=True)
if requests.__version__[0] == '0':
# 'stream' was called 'prefetch' before 1.0, with flipped meaning
get_kwargs = {'prefetch': False}
else:
get_kwargs = {'stream': True}
response = requests.get(fixed_url, **get_kwargs)
with salt.utils.fopen(dest, 'wb') as destfp:
for chunk in response.iter_content(chunk_size=32*1024):
destfp.write(chunk)