=== modified file 'cloudinit/url_helper.py'
--- cloudinit/url_helper.py 2015-01-21 22:56:53 +0000
+++ cloudinit/url_helper.py 2015-02-25 14:56:24 +0000
@@ -116,10 +116,13 @@
class UrlResponse(object):
def __init__(self, response):
self._response = response
+ self._contents = None
@property
def contents(self):
- return self._response.text
+ if self._contents is not None:
+ self._contents = self._response.raw.read()
+ return self._contents
@property
def url(self):
@@ -143,7 +146,7 @@
return self._response.status_code
def __str__(self):
- return self._response.text
+ return str(self.contents())
class UrlError(IOError):
@@ -190,6 +193,7 @@
req_args['timeout'] = max(float(timeout), 0)
if data:
req_args['method'] = 'POST'
+ req_args['stream'] = True
# It doesn't seem like config
# was added in older library versions (or newer ones either), thus we
# need to manually do the retries if it wasn't...
@@ -233,6 +237,7 @@
LOG.debug("[%s/%s] open '%s' with %s configuration", i,
manual_tries, url, filtered_req_args)
+ print("req_args: %s" % req_args)
r = requests.request(**req_args)
if check_status:
r.raise_for_status()