Using magic commands to import python packages from hubspot-api-client

Hello! I’m trying to run a workflow to eventually import data into HubSpot using a python script I wrote offline. However I am running into a problem when I try to import sub packages from the hubspot-api-client.

#HubSpot API Client -> https://pypi.org/project/hubspot-api-client/
# pipedream add-package hubspot-api-client-crm-contacts
import delorean
import simplejson
from hubspot.crm.contacts import BatchReadInputSimplePublicObjectId, BatchInputSimplePublicObjectBatchInput

I have tried a number of different ways to try and import this specific package (hubspot.crm.contacts) but I have not found anything that works yet.

Hello @taylor.gerik,

Pipedream uses Pypi to resolve the dependencies. But I do not see the package hubspot-api-client-crm-contacts package.

I’ve tested with the hubspot-api-client package instead and it works. Would you mind giving it a try?

# pipedream add-package hubspot-api-client
from hubspot.crm.contacts import BatchReadInputSimplePublicObjectId, BatchInputSimplePublicObjectBatchInput

import delorean
import simplejson

def handler(pd: "pipedream"):
  print(BatchReadInputSimplePublicObjectId)

Thank you very much! Your code worked just fine!

1 Like