You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
to_dict generates non serializable object because of enums #93
using Xero-python 1.8 on python 3.10.4 trying to convert a Journal to dictionary using to_dict method.
I expect to have a json serializable dict of primitive values however I get an AccountType enum which is not serializable.
simple enough to have a custom encoder that handles enums but it would also be rather simple to extend the serializer process here to enable proper conversion.
adding following code to models.py fixes the issue:
Enum issue was solved for me by upgrading to xero-python==1.16.0 however note that this introduced different errors for UUID and None
fromxero_python.api_client.serializerimportserialize_model@serialize_model.register(UUID)defserialize_uuid_model(model):
"""Serializes api model into an json serializable object. :param model: BaseModel instance to serialize :return: serialized object """returnmodel.hex
Activity
mseflek commentedon Oct 3, 2022
bumping this issue as I'm having the same problem.
farfanoide commentedon Oct 4, 2022
Enum issue was solved for me by upgrading to xero-python==1.16.0 however note that this introduced different errors for UUID and None