summaryrefslogtreecommitdiff
path: root/docker/api/client.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2018-01-31 14:32:32 -0800
committerJoffrey F <joffrey@docker.com>2018-01-31 14:42:01 -0800
commitdf8422d0791d7d03cd3e1efe37a9c72f242f1f78 (patch)
treedb555dc7a8c4f16f33c6ac4a7ddd1c072dbe6eef /docker/api/client.py
parentb180b8770a265e33099bd6da76c3e556a1028491 (diff)
downloaddocker-py-cleanup_deprecated.tar.gz
Refuse API version < 1.21 ; Remove associated code pathscleanup_deprecated
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/api/client.py')
-rw-r--r--docker/api/client.py27
1 files changed, 5 insertions, 22 deletions
diff --git a/docker/api/client.py b/docker/api/client.py
index 07bcfae..e69d143 100644
--- a/docker/api/client.py
+++ b/docker/api/client.py
@@ -1,6 +1,5 @@
import json
import struct
-import warnings
from functools import partial
import requests
@@ -27,7 +26,7 @@ from ..constants import (
MINIMUM_DOCKER_API_VERSION
)
from ..errors import (
- DockerException, TLSParameterError,
+ DockerException, InvalidVersion, TLSParameterError,
create_api_error_from_http_exception
)
from ..tls import TLSConfig
@@ -160,11 +159,9 @@ class APIClient(
)
)
if utils.version_lt(self._version, MINIMUM_DOCKER_API_VERSION):
- warnings.warn(
- 'The minimum API version supported is {}, but you are using '
- 'version {}. It is recommended you either upgrade Docker '
- 'Engine or use an older version of Docker SDK for '
- 'Python.'.format(MINIMUM_DOCKER_API_VERSION, self._version)
+ raise InvalidVersion(
+ 'API versions below {} are no longer supported by this '
+ 'library.'.format(MINIMUM_DOCKER_API_VERSION)
)
def _retrieve_server_version(self):
@@ -353,17 +350,8 @@ class APIClient(
break
yield data
- def _stream_raw_result_old(self, response):
- ''' Stream raw output for API versions below 1.6 '''
- self._raise_for_status(response)
- for line in response.iter_lines(chunk_size=1,
- decode_unicode=True):
- # filter out keep-alive new lines
- if line:
- yield line
-
def _stream_raw_result(self, response):
- ''' Stream result for TTY-enabled container above API 1.6 '''
+ ''' Stream result for TTY-enabled container '''
self._raise_for_status(response)
for out in response.iter_content(chunk_size=1, decode_unicode=True):
yield out
@@ -419,11 +407,6 @@ class APIClient(
return self._get_result_tty(stream, res, self._check_is_tty(container))
def _get_result_tty(self, stream, res, is_tty):
- # Stream multi-plexing was only introduced in API v1.6. Anything
- # before that needs old-style streaming.
- if utils.compare_version('1.6', self._version) < 0:
- return self._stream_raw_result_old(res)
-
# We should also use raw streaming (without keep-alives)
# if we're dealing with a tty-enabled container.
if is_tty: