Skip to content

Commit

Permalink
Allow passing Python bools as attribute values. (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
nk9 authored Nov 15, 2022
1 parent 1acb64d commit a0435f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pycognito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ def dict_to_cognito(attributes, attr_map=None):
if value in attributes.keys():
attributes[key] = attributes.pop(value)

return [{"Name": key, "Value": value} for key, value in attributes.items()]
def normalize(val):
if isinstance(val, bool):
return "true" if val else "false"
return val

return [
{"Name": key, "Value": normalize(value)} for key, value in attributes.items()
]


def camel_to_snake(camel_str):
Expand Down

0 comments on commit a0435f7

Please sign in to comment.