APIs & Integrations

aaron_payne
Member

API Python Documentation Incorrect - Unable to make GET request

I am simply trying to follow the on screen guide found on https://developers.hubspot.com/docs/api/crm/pipelines for python GET requests.

 

2023-09-26 10_47_51-CRM API _ Pipelines.png

 

import hubspot
from pprint import pprint
from hubspot.crm.properties import BatchInputPropertyName, ApiException

client = hubspot.Client.create(access_token="xxxx")

 

This results in the following error

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

 

This same code worked for me a few months ago but no longer is. What am I doing wrong here? 

0 Upvotes
1 Reply 1
PeterCsiba
Member

API Python Documentation Incorrect - Unable to make GET request

For what is worth I use hubspot-api-client in requirements

 

from hubspot import HubSpot
api_client = HubSpot()
tokens = api_client.auth.oauth.tokens_api.create(
  grant_type="authorization_code",
  redirect_uri=HUBSPOT_REDIRECT_URL,
  client_id=HUBSPOT_CLIENT_ID,
  client_secret=client_secret,
  # This is a one-time authorization code to get access and refresh tokens - so don't screw up.
  code=authorization_code,
)

 

0 Upvotes