From 08ffe141b8a46a43cd3c71398e21ffe527f72309 Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Thu, 31 Aug 2023 12:18:24 -0400 Subject: [PATCH 1/4] Fix request helper --- v4-client-py/dydx4/clients/helpers/request_helpers.py | 2 +- v4-client-py/tests/test_request_helpers.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 v4-client-py/tests/test_request_helpers.py diff --git a/v4-client-py/dydx4/clients/helpers/request_helpers.py b/v4-client-py/dydx4/clients/helpers/request_helpers.py index 3644338e..38d1c7be 100644 --- a/v4-client-py/dydx4/clients/helpers/request_helpers.py +++ b/v4-client-py/dydx4/clients/helpers/request_helpers.py @@ -12,7 +12,7 @@ def generate_query_path(url, params): if not entries: return url - paramsString = '&'.join('{key}={value}'.format( + paramsString = '&'.join('{key}={value.lower() if isinstance(value, bool) else value}'.format( key=x[0], value=x[1]) for x in entries if x[1] is not None) if paramsString: return url + '?' + paramsString diff --git a/v4-client-py/tests/test_request_helpers.py b/v4-client-py/tests/test_request_helpers.py new file mode 100644 index 00000000..f11c99f2 --- /dev/null +++ b/v4-client-py/tests/test_request_helpers.py @@ -0,0 +1,5 @@ +from dydx4.clients.helpers.request_helpers import generate_query_path + +def test_generate_query_path(): + query_path = generate_query_path('https://google.com', {'a': True, 'b': False, 'c': 'TEST'}) + assert query_path == 'https://google.com?a=true&b=false&c=TEST' From ad28d9130a3cc19921cbd06020b3b732ebe55f83 Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Thu, 31 Aug 2023 12:29:21 -0400 Subject: [PATCH 2/4] nits --- v4-client-py/dydx4/clients/helpers/request_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v4-client-py/dydx4/clients/helpers/request_helpers.py b/v4-client-py/dydx4/clients/helpers/request_helpers.py index 38d1c7be..46ff922a 100644 --- a/v4-client-py/dydx4/clients/helpers/request_helpers.py +++ b/v4-client-py/dydx4/clients/helpers/request_helpers.py @@ -12,7 +12,7 @@ def generate_query_path(url, params): if not entries: return url - paramsString = '&'.join('{key}={value.lower() if isinstance(value, bool) else value}'.format( + paramsString = '&'.join('{key}={str(value).lower() if isinstance(value, bool) else value}'.format( key=x[0], value=x[1]) for x in entries if x[1] is not None) if paramsString: return url + '?' + paramsString From 43a8238d03232a9b10b866edd3dd3d47dcb357a5 Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Thu, 31 Aug 2023 12:37:43 -0400 Subject: [PATCH 3/4] nit --- v4-client-py/dydx4/clients/helpers/request_helpers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/v4-client-py/dydx4/clients/helpers/request_helpers.py b/v4-client-py/dydx4/clients/helpers/request_helpers.py index 46ff922a..59727b47 100644 --- a/v4-client-py/dydx4/clients/helpers/request_helpers.py +++ b/v4-client-py/dydx4/clients/helpers/request_helpers.py @@ -12,8 +12,9 @@ def generate_query_path(url, params): if not entries: return url - paramsString = '&'.join('{key}={str(value).lower() if isinstance(value, bool) else value}'.format( - key=x[0], value=x[1]) for x in entries if x[1] is not None) + paramsString = '&'.join('{key}={value}'.format( + key=x[0], + value=str(x[1]).lower() if isinstance(x[1], bool) else x[1]) for x in entries if x[1] is not None) if paramsString: return url + '?' + paramsString From e1c6658bf9822bd2c5d8824ea80a1c55e8b551fe Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Thu, 31 Aug 2023 12:56:43 -0400 Subject: [PATCH 4/4] update version --- v4-client-py/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v4-client-py/pyproject.toml b/v4-client-py/pyproject.toml index fc0539f0..a9f1fabf 100644 --- a/v4-client-py/pyproject.toml +++ b/v4-client-py/pyproject.toml @@ -5,7 +5,7 @@ package-dir = {"" = "dydx4"} [tool.poetry] name = "dydx4" -version = "0.2.2" +version = "0.2.3" description = "dYdX v4 Client" authors = ["John Huang "] license = "Proprietary"