summaryrefslogtreecommitdiff
path: root/swiftclient/utils.py
diff options
context:
space:
mode:
authorVitaly Gridnev <vgridnev@mirantis.com>2017-03-07 13:38:22 +0400
committerVitaly Gridnev <gridnevvvit@gmail.com>2017-03-08 00:50:55 +0400
commit028c4824d0190e0b605ae9c90756167083e46cd3 (patch)
treed8a47a3a8633301d59dfc6aea8f70362c73f84ec /swiftclient/utils.py
parent91de5e8a385178b58cfeeb702c005ec2f2c5068a (diff)
downloadpython-swiftclient-028c4824d0190e0b605ae9c90756167083e46cd3.tar.gz
Fix logging of the gzipped body
Change-Id: I6d7ccbf4ef9b46e890ecec58842c5cdd2804c7a9 Closes-bug: 1670620
Diffstat (limited to 'swiftclient/utils.py')
-rw-r--r--swiftclient/utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/swiftclient/utils.py b/swiftclient/utils.py
index 9f8af1f..47856c2 100644
--- a/swiftclient/utils.py
+++ b/swiftclient/utils.py
@@ -143,11 +143,16 @@ def generate_temp_url(path, seconds, key, method, absolute=False,
return temp_url
-def parse_api_response(headers, body):
+def get_body(headers, body):
if headers.get('content-encoding') == 'gzip':
with gzip.GzipFile(fileobj=six.BytesIO(body), mode='r') as gz:
- body = gz.read()
+ nbody = gz.read()
+ return nbody
+ return body
+
+def parse_api_response(headers, body):
+ body = get_body(headers, body)
charset = 'utf-8'
# Swift *should* be speaking UTF-8, but check content-type just in case
content_type = headers.get('content-type', '')