From 79abb01643fbdcafbab63f424d5fb6abeca47eeb Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Mon, 2 May 2022 17:57:13 -0600 Subject: [PATCH] Handle true false in query params https://github.com/FusionAuth/fusionauth-python-client/issues/10 is the issue. when we are handed a True object, we need to serialize it to the string 'true'. In staticly typed languages we use a converter. I didn't think python had one, so just brute forced it with a function call. --- src/main/client/python.client.ftl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/client/python.client.ftl b/src/main/client/python.client.ftl index b44ff7f9..8a98ddb4 100644 --- a/src/main/client/python.client.ftl +++ b/src/main/client/python.client.ftl @@ -73,7 +73,7 @@ class FusionAuthClient: [#if param.type == "urlSegment"] .url_segment(${global.convertValue(param, "python")}) \ [#elseif param.type == "urlParameter"] - .url_parameter('${param.parameterName}', ${global.convertValue(param, "python")}) \ + .url_parameter('${param.parameterName}', self.convert_true_false(${global.convertValue(param, "python")})) \ [#elseif param.type == "body"] .body_handler(JSONBodyHandler(${camel_to_underscores(param.name)})) \ [/#if] @@ -85,6 +85,13 @@ class FusionAuthClient: .go() [/#list] + def convert_true_false(self,val): + if val == True: + return 'true' + if val == False: + return 'false' + return val + def start(self): return self.start_anonymous().authorization(self.api_key)