summaryrefslogtreecommitdiff
path: root/docker/api/container.py
diff options
context:
space:
mode:
authorDaniel Nephin <dnephin@gmail.com>2015-11-17 10:47:28 -0500
committerDaniel Nephin <dnephin@gmail.com>2015-11-17 10:47:28 -0500
commit0284eadaff45e89dc9010a84ec13fae4b4bc45cc (patch)
tree29512ccb856895bdcd8115727355984d7dd72938 /docker/api/container.py
parent4e441b2a6bbac7b9b43adca05800c8f46e18ec16 (diff)
parent7e2ec1ac6b49af1e98fe693051f61d73ba6d8f28 (diff)
downloaddocker-py-0284eadaff45e89dc9010a84ec13fae4b4bc45cc.tar.gz
Merge pull request #805 from sourcelair/enhancement/stats-no-stream
Add support for non-stream stats of containers
Diffstat (limited to 'docker/api/container.py')
-rw-r--r--docker/api/container.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/docker/api/container.py b/docker/api/container.py
index 49c0b95..00fa169 100644
--- a/docker/api/container.py
+++ b/docker/api/container.py
@@ -356,9 +356,14 @@ class ContainerApiMixin(object):
@utils.minimum_version('1.17')
@utils.check_resource
- def stats(self, container, decode=None):
+ def stats(self, container, decode=None, stream=True):
url = self._url("/containers/{0}/stats", container)
- return self._stream_helper(self._get(url, stream=True), decode=decode)
+ if stream:
+ return self._stream_helper(self._get(url, stream=True),
+ decode=decode)
+ else:
+ return self._result(self._get(url, params={'stream': False}),
+ json=True)
@utils.check_resource
def stop(self, container, timeout=10):