From 95528df93c29891dac95aeaaeabb12a06a830e30 Mon Sep 17 00:00:00 2001 From: Chris Henry Date: Fri, 1 Jul 2016 23:45:12 -0400 Subject: [PATCH 1/2] fix: Allow for multiple values for a parameter --- python_http_client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_http_client/client.py b/python_http_client/client.py index 41f44c7..9e6e554 100644 --- a/python_http_client/client.py +++ b/python_http_client/client.py @@ -98,7 +98,7 @@ def _build_url(self, query_params): url += '/{0}'.format(self._url_path[count]) count += 1 if query_params: - url_values = urlencode(sorted(query_params.items())) + url_values = urlencode(sorted(query_params.items()), True) url = '{0}?{1}'.format(url, url_values) url = self._build_versioned_url(url) if self._version else self.host + url return url From 36e13ac59c8d5b2d9df208f551ae7cbd6cda96ef Mon Sep 17 00:00:00 2001 From: Chris Henry Date: Sat, 2 Jul 2016 00:20:18 -0400 Subject: [PATCH 2/2] new: Test case to cover multiple values for a single parameter --- tests/test_unit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_unit.py b/tests/test_unit.py index c9a5cbf..f0c1847 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -93,8 +93,8 @@ def test__build_url(self): self.client._version = 3 url = '{0}/v{1}{2}'.format(self.host, str(self.client._version), - '/here/there/1?hello=0&world=1') - query_params = {'hello': 0, 'world': 1} + '/here/there/1?hello=0&world=1&ztest=0&ztest=1') + query_params = {'hello': 0, 'world': 1, 'ztest': [0,1]} built_url = self.client._build_url(query_params) self.assertEqual(built_url, url)