From bd0aa0672e0ebb5dfaa2178a8ffce79be143524b Mon Sep 17 00:00:00 2001 From: Stuart McLaren Date: Sat, 11 Apr 2015 10:28:20 +0000 Subject: Fix https stack trace on python 3.4 client When using the client with python 3.4 and no ssl compression the following stack trace ocurrs: TypeError: startswith first arg must be bytes or a tuple of bytes, not str Closes-bug: 1442883 Related-bug: 1357430 Change-Id: I8e28f0bb1f3e866f11851247ce31470ca8c2af4f --- glanceclient/common/https.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'glanceclient/common/https.py') diff --git a/glanceclient/common/https.py b/glanceclient/common/https.py index 51f8f6d..649d14b 100644 --- a/glanceclient/common/https.py +++ b/glanceclient/common/https.py @@ -158,7 +158,9 @@ class HTTPSAdapter(adapters.HTTPAdapter): # NOTE(flaper87): Make sure the url is encoded, otherwise # python's standard httplib will fail with a TypeError. url = super(HTTPSAdapter, self).request_url(request, proxies) - return encodeutils.safe_encode(url) + if six.PY2: + url = encodeutils.safe_encode(url) + return url def _create_glance_httpsconnectionpool(self, url): kw = self.poolmanager.connection_kw -- cgit v1.2.1