summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2018-11-08 17:13:19 -0800
committerJoffrey F <joffrey@docker.com>2018-11-28 11:56:28 -0800
commitd9e08aedc3743c133bc4bb87917bc0914f9ff63d (patch)
tree82547fb9298574f3a89880f0b97e2b7d9a274e58
parentebfba8d4c3136015c73cd164202099cc1787c0e5 (diff)
downloaddocker-py-d9e08aedc3743c133bc4bb87917bc0914f9ff63d.tar.gz
Disallow incompatible combination stats(decode=True, stream=False)
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r--docker/api/container.py7
-rw-r--r--docker/models/containers.py3
2 files changed, 8 insertions, 2 deletions
diff --git a/docker/api/container.py b/docker/api/container.py
index 8858aa6..753e0a5 100644
--- a/docker/api/container.py
+++ b/docker/api/container.py
@@ -1071,7 +1071,8 @@ class ContainerApiMixin(object):
Args:
container (str): The container to stream statistics from
decode (bool): If set to true, stream will be decoded into dicts
- on the fly. False by default.
+ on the fly. Only applicable if ``stream`` is True.
+ False by default.
stream (bool): If set to false, only the current stats will be
returned instead of a stream. True by default.
@@ -1085,6 +1086,10 @@ class ContainerApiMixin(object):
return self._stream_helper(self._get(url, stream=True),
decode=decode)
else:
+ if decode:
+ raise errors.InvalidArgument(
+ "decode is only available in conjuction with stream=True"
+ )
return self._result(self._get(url, params={'stream': False}),
json=True)
diff --git a/docker/models/containers.py b/docker/models/containers.py
index a3fd1a8..493b9fc 100644
--- a/docker/models/containers.py
+++ b/docker/models/containers.py
@@ -385,7 +385,8 @@ class Container(Model):
Args:
decode (bool): If set to true, stream will be decoded into dicts
- on the fly. False by default.
+ on the fly. Only applicable if ``stream`` is True.
+ False by default.
stream (bool): If set to false, only the current stats will be
returned instead of a stream. True by default.