mirror of https://github.com/docker/docker-py.git
Merge pull request #492 from ggtools/json-stats
Add decode parameter to be able to the the stats as a dictionary
This commit is contained in:
commit
ec642f3710
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue