getenv ( "HUBSPOT_CLIENT_SECRET" ), ) except InvalidSignatureError : print ( "Request signature is not valid" ) Retry middleware get_page () except ApiException as e : print ( "Exception when calling cards_api->create: %s \n " % e ) Using utils Get OAuth url: from import get_auth_url auth_url = get_auth_url ( scopes = ( 'contacts' ,), client_id = 'client_id', redirect_uri = ' ) Validate HubSpot request signatureĮxample of usage from Webhooks Sample App: import os from flask import request from import validate_signature from hubspot.exceptions import InvalidSignatureError try : validate_signature ( signature = request. CMS API Get audit logs: from _logs import ApiException try : audit_logs_page = api_client. Please note that pagination is used under the hood to get all results. Get_all method is available for all major objects and works like all_contacts = api_client. get_page ( object_type = "my_custom_object_type" ) except ApiException as e : print ( "Exception when requesting custom objects: %s \n " % e ) Get all: get_by_id ( 'contact_id' ) except ApiException as e : print ( "Exception when requesting contact by id: %s \n " % e ) Get custom objects page: from import ApiException try : my_custom_objects_page = api_client. create ( simple_public_object_input = simple_public_object_input ) except ApiException as e : print ( "Exception when creating contact: %s \n " % e ) Get contact by id: from import ApiException try : contact_fetched = api_client.
HUBSPOT API DOCUMENTATION CODE
create_token ( grant_type = "authorization_code", redirect_uri = ', client_id = 'client_id', client_secret = 'client_secret', code = 'code' ) except ApiException as e : print ( "Exception when calling create_token method: %s \n " % e ) CRM API Create contact: from import SimplePublicObjectInput from import ApiException try : simple_public_object_input = SimplePublicObjectInput ( properties = ) api_response = api_client. access_token = 'your_access_token' OAuth API Obtain OAuth2 access token: from import ApiException try : tokens = api_client. Quickstart Configuring HubSpot client from hubspot import HubSpot api_client = HubSpot () # or with api_key api_client = HubSpot ( api_key = 'your_api_key' ) # or with access_token api_client = HubSpot () api_client. Make sure you have Python 3.5+ and pip installed.
HUBSPOT API DOCUMENTATION INSTALL
If you just want to use the package, run: pip install -upgrade hubspot-api-client
Sample Applications can be found in Sample apps Documentation
Python HubSpot API v3 SDK(Client) files and sample apps