Change fileclient from urllib2 to requests

This commit is contained in:
Joseph Hall 2014-04-01 15:18:15 -06:00
parent 255063ae15
commit f809f91bf5
2 changed files with 5 additions and 3 deletions

View file

@ -6,3 +6,4 @@ PyYAML
pyzmq >= 2.2.0
MarkupSafe
apache-libcloud >= 0.14.0
requests

View file

@ -10,6 +10,7 @@ import hashlib
import os
import shutil
import subprocess
import requests
# Import third party libs
import yaml
@ -554,9 +555,9 @@ class Client(object):
else:
fixed_url = url
try:
with contextlib.closing(url_open(fixed_url)) as srcfp:
with salt.utils.fopen(dest, 'wb') as destfp:
shutil.copyfileobj(srcfp, destfp)
req = requests.get(fixed_url)
with salt.utils.fopen(dest, 'wb') as destfp:
destfp.write(req.content)
return dest
except HTTPError as ex:
raise MinionError('HTTP error {0} reading {1}: {3}'.format(