From cf35b3843319f906ebb35b4478c62a63a70a9396 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Fri, 13 Sep 2013 12:51:23 -0400 Subject: [PATCH] Support https:// URLs (replacing with wss://) when attaching websocket --- docker/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/client.py b/docker/client.py index 28927dd4..78f7abcf 100644 --- a/docker/client.py +++ b/docker/client.py @@ -154,7 +154,9 @@ class Client(requests.Session): def attach_websocket(self, container, params=None): url = self._url("/containers/{0}/attach/ws".format(container)) req = requests.Request("POST", url, params=self._attach_params(params)) - full_url = req.prepare().url.replace("http://", "ws://", 1) + full_url = req.prepare().url + full_url = full_url.replace("http://", "ws://", 1) + full_url = full_url.replace("https://", "wss://", 1) return self._create_websocket_connection(full_url) def _create_websocket_connection(self, url):