Skip to content

Commit

Permalink
Merge pull request #492 from ggtools/json-stats
Browse files Browse the repository at this point in the history
Add decode parameter to be able to the the stats as a dictionary
  • Loading branch information
shin- committed Feb 12, 2015
2 parents 21e189c + 26e74c8 commit ec642f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,15 @@ def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
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!')

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):
Expand Down

0 comments on commit ec642f3

Please sign in to comment.