summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <f.joffrey@gmail.com>2015-02-12 13:36:27 -0800
committerJoffrey F <f.joffrey@gmail.com>2015-02-12 13:36:27 -0800
commitec642f37103552835b0e5fd12e7ca81b75d6ccf5 (patch)
treec8e43edaa922ed9720d5f5cdbd9e6a27ab8d2e9a
parent21e189c923d2fa8c362e13ecef5f81f1b837b817 (diff)
parent26e74c8cc43cd5306237d4048b6fdecf280ea5f7 (diff)
downloaddocker-py-ec642f37103552835b0e5fd12e7ca81b75d6ccf5.tar.gz
Merge pull request #492 from ggtools/json-stats
Add decode parameter to be able to the the stats as a dictionary
-rw-r--r--docker/client.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/docker/client.py b/docker/client.py
index 6c14706..839b04d 100644
--- a/docker/client.py
+++ b/docker/client.py
@@ -869,7 +869,7 @@ class Client(requests.Session):
res = self._post_json(url, data=start_config)
self._raise_for_status(res)
- def stats(self, container):
+ def stats(self, container, decode=None):
if utils.compare_version('1.17', self._version) < 0:
raise errors.InvalidVersion(
'Stats retrieval is not supported in API < 1.17!')
@@ -877,7 +877,7 @@ class Client(requests.Session):
if isinstance(container, dict):
container = container.get('Id')
url = self._url("/containers/{0}/stats".format(container))
- return self._stream_helper(self._get(url, stream=True))
+ return self._stream_helper(self._get(url, stream=True), decode=decode)
def stop(self, container, timeout=10):
if isinstance(container, dict):