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

Can't serialize value type 'UUID' #161

Open
howieweiner opened this issue Oct 21, 2024 · 2 comments
Open

Can't serialize value type 'UUID' #161

howieweiner opened this issue Oct 21, 2024 · 2 comments

Comments

@howieweiner
Copy link

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
    ```
Copy link

PETOSS-653

Copy link

Thanks for raising an issue, a ticket has been created to track your request

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