Aug 2, 202212:29 AM - edited Aug 2, 202212:32 AM
Member
Very slow API response (property creation)
SOLVE
Hi all,
I am writing a Python script for automating the process of creating a lot of properties in Hubspot. My code looks something like (taken from the tutorial shown in https://developers.hubspot.com/docs/api/crm/properties
client = hubspot.Client.create(api_key=API_KEY)
for program in programs:
for month in range(1,13):
property_create = PropertyCreate(name=f'name_{program}_{month}', label=f'name_{program}_{month}', type='number', field_type='number', group_name=GROUP_NAME, display_order=2, has_unique_values=False, hidden=False, form_field=True)
try:
api_response = client.crm.properties.core_api.create(object_type="Company", property_create=property_create)
except ApiException as e:
print("Exception when calling core_api->create: %s\n" % e)
......
......
... repetitive code for property create ...
when I checked the call log of my API key, the response time was very inconsistent. Sometimes it makes 3 calls within the same minute, sometimes it took up to 9-10 minutes just to make one call. Any idea why this might be happening and how I might be able to speed up the response time from the API call?
Please note that the above is a simplified version of my code (functionally the same, but I put some dummy names in the parameters).
I have been in similar situations and typically HusSpot is not the issue based on the returns I am getting. If this were me, I would have another app with a simple call that I could loop N number of times to have a sample for a psuedo stress test. If all is well there I would move on to the next troubleshooting step. Given HubSpot is rarely the issue when it comes to performance, I would consider debugging, stepping through the code while including the libraries (I use VSCode - change the json for justmycode)...outside of that...not a lot to go on here.
I have been in similar situations and typically HusSpot is not the issue based on the returns I am getting. If this were me, I would have another app with a simple call that I could loop N number of times to have a sample for a psuedo stress test. If all is well there I would move on to the next troubleshooting step. Given HubSpot is rarely the issue when it comes to performance, I would consider debugging, stepping through the code while including the libraries (I use VSCode - change the json for justmycode)...outside of that...not a lot to go on here.