I’m trying to create an analytics pipeline in Python / Jupyter. I have been able to access contacts and deals data using api_client.crm.contacts.get_all() which provides me wit a JSON Class ‘List’. If I copy and paste this output and use json_normalize, I am able to convert it into a dataframe. However if I attempt to access the data directly I get the following error: ‘SimplePublicObjectWithAssociations’ object has no attribute ‘values’ or cannot unpack non-iterable SimplePublicObjectWithAssociations object. Every attempt I’ve made to convert SimplePublicObjectWithAssociations has failed. Further I have been able to access single records by their ID, suggesting that something on the Hubspot side is not allowing me to loop over the contacts data to pull it all into Jupyter. Has anyone else encountered this issue?
code:
all_contacts = api_client.crm.contacts.get_all()
data = all_contacts
df = pd.json_normalize(data, max_level=2)
‘SimplePublicObjectWithAssociations’ object has no attribute ‘values’
data = all_contacts
for i,x in data:
data[i]= x.to_dict()
df = json.loads(data, max_level=2)
cannot unpack non-iterable SimplePublicObjectWithAssociations object