Don't import websocket-client if environment is python 3 (not supported)

This commit is contained in:
shin- 2013-11-08 19:10:41 +01:00
parent 0901b28957
commit 287032cf0e
1 changed files with 5 additions and 1 deletions

View File

@ -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