xero-python
xero-python copied to clipboard
Can't serialize value type 'UUID'
Hi. I've just started using the xero-python SDK (v 6.3.0) to retrieve Invoices. There appears to be an issue in the client when serializing UUID fields
This code:
response = accounting_api.get_invoice(XERO_TENANT_ID, invoice_id)
throws a ValueError `Can't serialize value type 'UUID' when attempting to serialize the model.
I've resolved this issue by patching the serializer based on this suggestion in Issue #93
@serialize_model.register(UUID)
def serialize_uuid_model(model):
"""Serializes api model into an json serializable object.
:param model: BaseModel instance to serialize
:return: serialized object
"""
return model.hex
```
PETOSS-653
Thanks for raising an issue, a ticket has been created to track your request