diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-09-01 03:18:18 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-09-01 03:18:18 +0000 |
commit | 92544c58c547e1ccf9d7df8c417c6a161a355ca8 (patch) | |
tree | 42875d4ffa6ea387b83a3b359f71540d6bc4b0bb /swiftclient/client.py | |
parent | 98085c961fc9421ffb07e62dacee67da9b7fcd16 (diff) | |
parent | f728027bed59d08a6491ae9c14d2f5968f8d6fa3 (diff) | |
download | python-swiftclient-92544c58c547e1ccf9d7df8c417c6a161a355ca8.tar.gz |
Merge "Accept gzip-encoded API responses"
Diffstat (limited to 'swiftclient/client.py')
-rw-r--r-- | swiftclient/client.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index a39185f..ee5a838 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -739,7 +739,7 @@ def get_account(url, token, marker=None, limit=None, prefix=None, if end_marker: qs += '&end_marker=%s' % quote(end_marker) full_path = '%s?%s' % (parsed.path, qs) - headers = {'X-Auth-Token': token} + headers = {'X-Auth-Token': token, 'Accept-Encoding': 'gzip'} if service_token: headers['X-Service-Token'] = service_token method = 'GET' @@ -866,6 +866,7 @@ def get_container(url, token, container, marker=None, limit=None, else: headers = {} headers['X-Auth-Token'] = token + headers['Accept-Encoding'] = 'gzip' if full_listing: rv = get_container(url, token, container, marker, limit, prefix, delimiter, end_marker, path, http_conn, @@ -1464,10 +1465,11 @@ def get_capabilities(http_conn): :raises ClientException: HTTP Capabilities GET failed """ parsed, conn = http_conn - conn.request('GET', parsed.path, '') + headers = {'Accept-Encoding': 'gzip'} + conn.request('GET', parsed.path, '', headers) resp = conn.getresponse() body = resp.read() - http_log((parsed.geturl(), 'GET',), {'headers': {}}, resp, body) + http_log((parsed.geturl(), 'GET',), {'headers': headers}, resp, body) if resp.status < 200 or resp.status >= 300: raise ClientException.from_response( resp, 'Capabilities GET failed', body) |