From 26e74c8cc43cd5306237d4048b6fdecf280ea5f7 Mon Sep 17 00:00:00 2001 From: Christophe Labouisse Date: Thu, 12 Feb 2015 22:27:02 +0100 Subject: [PATCH] Add decode parameter to be able to the the stats as a dictionary --- docker/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/client.py b/docker/client.py index 6c147068..839b04d7 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):