Skip to content

Commit f33731d

Browse files
committed
Encode unicode for python 2
1 parent a2beed3 commit f33731d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

connect/config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ def load_from_file(self, file):
8888
raise TypeError('Invalid config file `{}`\n'
8989
'ERROR: {}'.format(file, str(ex)))
9090

91-
(api_url, api_key, products) = (configs.get('apiEndpoint', '').encode('utf-8'),
92-
configs.get('apiKey', '').encode('utf-8'),
93-
configs.get('products'))
91+
(api_url, api_key, products) = (configs.get('apiEndpoint', ''),
92+
configs.get('apiKey', ''),
93+
configs.get('products', ''))
9494

9595
products = products.encode('utf-8') if not isinstance(products, (str, list)) else products
96+
api_url = api_url.encode('utf-8') if not isinstance(api_url, str) else api_url
97+
api_key = api_key.encode('utf-8') if not isinstance(api_key, str) else api_key
9698

9799
self.check_credentials(api_url, api_key, products)
98100
self._set_attr(api_url, api_key, products)

0 commit comments

Comments
 (0)