Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix query string to cast bool to lowercase string #20

Merged
merged 4 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion v4-client-py/dydx4/clients/helpers/request_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def generate_query_path(url, params):
return url

paramsString = '&'.join('{key}={value}'.format(
key=x[0], value=x[1]) for x in entries if x[1] is not None)
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

Expand Down
5 changes: 5 additions & 0 deletions v4-client-py/tests/test_request_helpers.py
Original file line number Diff line number Diff line change
@@ -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'