[f22-branch 2/2] Switch back to urllib for determining livepayload size
dashea
installerbot-noreply at redhat.com
Tue Mar 17 20:28:33 UTC 2015
From: David Shea <dshea at redhat.com>
This reverts the livepayload.py portion of
4e9169e47c593e7b7dc31ce623365aa746e3a33b. python-requests only supports
http and https, so this returns support for ftp payloads.
---
pyanaconda/packaging/livepayload.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index ab7714b..4cc9d12 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -33,10 +33,10 @@
import stat
from time import sleep
from threading import Lock
-import requests
from urlgrabber.grabber import URLGrabber
from urlgrabber.grabber import URLGrabError
from pyanaconda.iutil import ProxyString, ProxyStringError, lowerASCII
+import urllib
import hashlib
import glob
@@ -275,21 +275,21 @@ def _setup_url_image(self):
error = None
try:
- response = requests.get(self.data.method.url, proxies=self._proxies, verify=True)
+ req = urllib.urlopen(self.data.method.url, proxies=self._proxies)
# At this point we know we can get the image and what its size is
# Make a guess as to minimum size needed:
# Enough space for image and image * 3
- if response.headers.get('content-length'):
- self._min_size = int(response.headers.get('content-length')) * 4
+ if req.info().get("content-length"):
+ self._min_size = int(req.info().get('content-length')) * 4
except IOError as e:
log.error("Error opening liveimg: %s", e)
error = e
else:
# If it is a http request we need to check the code
method = self.data.method.url.split(":", 1)[0]
- if method.startswith("http") and response.status_code != 200:
- error = "http request returned %s" % response.getcode()
+ if method.startswith("http") and req.getcode() != 200:
+ error = "http request returned %s" % req.getcode()
return error
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/f5316e5c4d1072b3643cee2132df2266246d5e2d
More information about the anaconda-patches
mailing list