From 287032cf0ee52e8722874dbd9d3281c8fcadb0b6 Mon Sep 17 00:00:00 2001 From: shin- Date: Fri, 8 Nov 2013 19:10:41 +0100 Subject: [PATCH] Don't import websocket-client if environment is python 3 (not supported) --- docker/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/client.py b/docker/client.py index 241d714d..635ba06d 100644 --- a/docker/client.py +++ b/docker/client.py @@ -24,7 +24,8 @@ import docker.auth as auth import docker.unixconn as unixconn import docker.utils as utils -import websocket +if not six.PY3: + import websocket class APIError(requests.exceptions.HTTPError): @@ -160,6 +161,9 @@ class Client(requests.Session): return res.raw._fp.fp._sock def _attach_websocket(self, container, params=None): + if six.PY3: + raise NotImplementedError("This method is not currently supported " + "under python 3") url = self._url("/containers/{0}/attach/ws".format(container)) req = requests.Request("POST", url, params=self._attach_params(params)) full_url = req.prepare().url