Skip to content

Commit 26e74c8

Browse files
committed
Add decode parameter to be able to the the stats as a dictionary
1 parent 21e189c commit 26e74c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docker/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,15 +869,15 @@ def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
869869
res = self._post_json(url, data=start_config)
870870
self._raise_for_status(res)
871871

872-
def stats(self, container):
872+
def stats(self, container, decode=None):
873873
if utils.compare_version('1.17', self._version) < 0:
874874
raise errors.InvalidVersion(
875875
'Stats retrieval is not supported in API < 1.17!')
876876

877877
if isinstance(container, dict):
878878
container = container.get('Id')
879879
url = self._url("/containers/{0}/stats".format(container))
880-
return self._stream_helper(self._get(url, stream=True))
880+
return self._stream_helper(self._get(url, stream=True), decode=decode)
881881

882882
def stop(self, container, timeout=10):
883883
if isinstance(container, dict):

0 commit comments

Comments
 (0)