Issue ussing the basic API for fetching company list, The API doesn’t work using python 3.6
Code (taken from your website)
import hubspot
from pprint import pprint
from hubspot.crm.companies import ApiException
max_results = 500
# hapikey = ‘pat-na1-455c4653-7117-415a-9805-013ee8af7e91’
limit = 5
company_list = []
get_all_companies_url = “https://api.hubapi.com/crm/v3/objects/companies”
YOUR_ACCESS_TOKEN = “pat-”
client = hubspot.Client.create(access_token=“YOUR_ACCESS_TOKEN”)
try:
api_response = client.crm.companies.basic_api.get_crm_v3_objects_companies(limit=10, archived=False)
pprint(api_response)
except ApiException as e:
print(“Exception when calling basic_api->get_crm_v3_objects_companies: %s\n” % e)
--------------
output
---------------
warnings.warn(
Traceback (most recent call last):
File “/Users/xxxx/pythonProject/pythonProject/pythonProject/pythonProject/scraper/python/hubspot_conn.py”, line 16, in <module>
api_response = client.crm.companies.basic_api.get_crm_v3_objects_companies(limit=10, archived=False)
AttributeError: ‘BasicApi’ object has no attribute ‘get_crm_v3_objects_companies’
Process finished with exit code 1
