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

[BUG] Identity beta model can not be serialized to json (using to_json() extension method) #14

Open
ianphilm opened this issue May 20, 2024 · 0 comments

Comments

@ianphilm
Copy link

In attempting to convert the return value of a sailpoint.beta.IdentitiesApi.list_identities() call to a list of json objects, the identity.to_json() call fails with the below error:

line 147, in main
test = [i.to_json() for i in identities]
^^^^^^^^^^^
File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/models/identity.py", line 84, in to_json
return json.dumps(self.to_dict())
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type datetime is not JSON serializable

I'm unsure if this is expected / not really a bug, but it seems like the to_json() parsing logic would generally be able to handle datetime objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant