klaviyo / klaviyo-api-python

Python SDK for Klaviyo API
https://developers.klaviyo.com
MIT License
35 stars 5 forks source link

additional_fields_profile=['subscriptions'] throwing error #61

Closed jchappe closed 1 month ago

jchappe commented 1 month ago

I'm trying to add the additional_fields_profile=['subscriptions'] parameter to the get_profiles method but it's throwing an error:

pydantic_core._pydantic_core.ValidationError: 3 validation errors for SMSMarketing consent_timestamp Input should be a valid datetime [type=datetime_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/datetime_type method Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/string_type last_updated Input should be a valid datetime [type=datetime_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/datetime_type

Here is my request: Klaviyo.Profiles.get_profiles(dditional_fields_profile=['subscriptions'])

sanfordj commented 1 month ago

looking into this, will release a patch soon!

sanfordj commented 1 month ago

working on that patch, but in the mean time, you can use our dictionary response option to work around this error.

from openapi_client.api_arg_options import USE_DICTIONARY_FOR_RESPONSE_DATA
res = self.client.Profiles.get_profiles(additional_fields_profile=['subscriptions'], options={
            USE_DICTIONARY_FOR_RESPONSE_DATA: True
        })
sanfordj commented 1 month ago

fixed in 11.0.1 https://github.com/klaviyo/klaviyo-api-python/releases/tag/v11.0.1

jchappe commented 1 month ago

Thank you!!