APIs & Integrations

SSakhuja
Member

Update Deals Hubspot

SOLVE

def update_deals():
client = hubspot.Client.create(api_key="XXXX")

batch_input_simple_public_object_batch_input = BatchInputSimplePublicObjectBatchInput(inputs=[{"id":"123","properties":{"amount":"70","dealname":"ABCDEFG", "dealstage":"Current"}}])

try:
api_response = client.crm.deals.batch_api.update(batch_input_simple_public_object_batch_input=batch_input_simple_public_object_batch_input)
pprint(api_response)

except ApiException as e:
print("Exception when calling batch_api->update: %s\n" % e)

 

Resulting in Error:

AttributeError: module 'hubspot' has no attribute 'Client' 

 

Alredy done:

pip install --upgrade hubspot-api-client

 

 

0 Upvotes
1 Accepted solution
SSakhuja
Solution
Member

Update Deals Hubspot

SOLVE

Hi @taran42,

 

I believe you have not read my the problem correctly. Nevermind I have solved the issue.

 

It was not about get all deals but about update all deals. And I refrerred to link https://developers.hubspot.com/docs/api/crm/deals, however the Create.client function used in the sample code is incorrect and needs to be updated on the Hubspot website. It should be like -

 

client = client.Client.create(api_key='XXXXXXXXXXXXXXXXXXXX')

 

SSakhuja_0-1653262420458.png

 

Thanks!

View solution in original post

0 Upvotes
6 Replies 6
taran42
Contributor

Update Deals Hubspot

SOLVE

@SSakhuja Can you provide a little more context here? I'm not 100% on what I am looking at other than there is an error.

SSakhuja
Member

Update Deals Hubspot

SOLVE

Hi Taran, 

 

Thanks for looking at it.

 

The goal was up to update deals in bulk and took this code from the official website of Hubspot as a base code to update deals.

 

I reckon it makes a client conncection with hubspot with the passing of the api key.

client = hubspot.Client.create(api_key="XXXX")

 

It failing here. So looking for a solution of how to get this done or suggest any other way to get this done in python.

 

Thanks

0 Upvotes
taran42
Contributor

Update Deals Hubspot

SOLVE

Depending on what version of the Hubspot API you're using, you can use the Get All Deals in v2 or Deals in v3. I use the v2 method for how I am currently pulling deals and it works for me.

SSakhuja
Solution
Member

Update Deals Hubspot

SOLVE

Hi @taran42,

 

I believe you have not read my the problem correctly. Nevermind I have solved the issue.

 

It was not about get all deals but about update all deals. And I refrerred to link https://developers.hubspot.com/docs/api/crm/deals, however the Create.client function used in the sample code is incorrect and needs to be updated on the Hubspot website. It should be like -

 

client = client.Client.create(api_key='XXXXXXXXXXXXXXXXXXXX')

 

SSakhuja_0-1653262420458.png

 

Thanks!

0 Upvotes
taran42
Contributor

Update Deals Hubspot

SOLVE

I'm glad you were able to figure out where the problem was!

dennisedson
HubSpot Product Team
HubSpot Product Team

Update Deals Hubspot

SOLVE

@taran42 , any thoughts here?  😀

0 Upvotes