APIs & Integrations

SSakhuja
Membre

Update Deals Hubspot

Résolue

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 Votes
1 Solution acceptée
SSakhuja
Solution
Membre

Update Deals Hubspot

Résolue

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!

Voir la solution dans l'envoi d'origine

0 Votes
6 Réponses
taran42
Contributeur

Update Deals Hubspot

Résolue

@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
Membre

Update Deals Hubspot

Résolue

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 Votes
taran42
Contributeur

Update Deals Hubspot

Résolue

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
Membre

Update Deals Hubspot

Résolue

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 Votes
taran42
Contributeur

Update Deals Hubspot

Résolue

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

dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

Update Deals Hubspot

Résolue

@taran42 , any thoughts here?  😀

0 Votes