hubspot-python
HubSpot API wrapper written in Python.
Installing
pip install hubspot-python
Requirements
- requests
Usage
Client instantiation
from hubspot.client import Client
client = Client(APP_ID, HAPIKEY, CLIENT_ID, CLIENT_SECRET)
Companies
Get all companies
response = client.companies.get_companies(data)
Create a Company
data = {
"name": "A company name",
"description": "A company description"
}
response = client.companies.create_company(data)
Delete a Company
response = client.companies.delete_company(COMPANY_ID)
Get Recently Created Companies
response = client.companies.get_recently_created_companies()
Get a Company
response = client.companies.get_company(COMPANY_ID)
Contact Lists
Get contact lists
response = client.contact_lists.get_contact_lists()
Create a new contact list
data = {
"name": "tweeters",
"dynamic": true,
"portalId": 62515,
"filters":
[
[{
"operator": "EQ",
"value": "@hubspot",
"property": "twitterhandle",
"type": "string"
}]
]
}
response = client.contact_lists.create_contact_list(data)
Delete a contact list
response = client.contact_lists.delete_contact_list(CONTACT_LIST_ID)
Get recently added contacts from a list
response = client.contact_lists.get_recently_added_contacts_in_a_list()
Get a contact list by its unique ID
response = client.contact_lists.get_contact_list(CONTACT_LIST_ID)
Add existing contacts to a list
data = {
"vids": [
3057124,
5524274
],
"emails": [
"testingapis@hubspot.com"
]
}
response = client.contact_lists.add_contact_to_list(CONTACT_LIST_ID, data)
Contacts
Get all contacts
response = client.contacts.get_contacts()
Create a new contact
data = {
"email": "testingapis@hubspot.com",
"firstname": "Adrian",
"lastname": "Mott",
"website": "http://hubspot.com",
"company": "HubSpot",
"phone": "555-122-2323",
"address": "25 First Street",
"city": "Cambridge",
"state": "MA",
"zip": "02139",
}
response = client.contacts.create_contact(data)
Delete a contact
response = client.contacts.delete_contact(CONTACT_ID)
Get recently created contacts
response = client.contacts.get_recently_created_contacts()
Get a contact list by its unique ID
response = client.contacts.get_contact(CONTACT_ID)
Deals
Get all deals
response = client.deals.get_deals()
Create a Deal
data = {
"dealname": "Tim's Newer Deal",
"dealstage": "appointmentscheduled",
"pipeline": "default",
"hubspot_owner_id": "24",
"closedate": 1409443200000,
"amount": "60000",
"dealtype": "newbusiness",
}
response = client.deals.create_deal(data)
Delete a Deal
response = client.deals.delete_deal(DEAL_ID)
Get Recently Created Deals
response = client.deals.get_recently_created_deals()
Get a contact list by its unique ID
response = client.deals.get_deal(DEAL_ID)
Fields (Properties)
Get all fields
response = client.fields.get_fields(MODULE)
Integrations
Get all fields
response = client.integrations.get_account_details()
Get all fields
response = client.integrations.get_daily_api_usage()
Webhooks
Viewing Settings
response = client.webhooks.get_settings()
Updating Settings
data = {
"webhookUrl": "https://testing.com/webhook-modified",
"maxConcurrentRequests": 25
}
response = client.webhooks.update_settings(data)
Get Subscriptions
response = client.webhooks.get_subscriptions()
Create a New Subscription
data = {
"subscriptionDetails" : {
"subscriptionType" : "company.propertyChange",
"propertyName" : "companyname"
},
"enabled": False
}
response = client.webhooks.create_subscription(data)
Update a Subscription
data = {
"enabled": False
}
response = client.webhooks.create_subscription(SUBSCRIPTION_ID, data)
Delete a Subscription
response = client.webhooks.delete_subscription(SUBSCRIPTION_ID)
Workflows
Get workflows
response = client.workflows.get_workflows()
Get workflow
response = client.workflows.get_workflow(WORKFLOW_ID)
Create a workflow
data = {
"name": "Test Workflow",
"type": "DRIP_DELAY",
"onlyEnrollsManually": true,
"actions": [
{
"type": "DELAY",
"delayMillis": 3600000
},
{
"newValue": "HubSpot",
"propertyName": "company",
"type": "SET_CONTACT_PROPERTY"
},
{
"type": "WEBHOOK",
"url": "https://www.myintegration.com/webhook.php",
"method": "POST",
"authCreds": {
"user": "user",
"password": "password"
}
}
]
}
response = client.workflows.create_workflow(data)
Delete a Deal
response = client.workflows.delete_workflow(WORKFLOW_ID)
Enroll a contact into a workflow
response = client.workflows.enroll_a_contact_into_workflow(WORKFLOW_ID, EMAIL)
Unenroll a contact from a workflow
response = client.workflows.unenroll_a_contact_into_workflow(WORKFLOW_ID, EMAIL)
Metadata
Release files for hubspot-python 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hubspot_python-1.0.3.tar.gz | 10.0 kB | Without provenance | Details for hubspot_python-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hubspot_python-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for hubspot_python-1.0.3-py3-none-any.whl |
Total release size: 22.4 kB
Release files / hubspot_python-1.0.3.tar.gz
| Download URL | hubspot_python-1.0.3.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46bb912bbcd1ed2992097c50385f2d391d92f65d1300b11998b856e34d0a417f
|
|
BLAKE2b-256 checksum How to use checksums |
972b34241fb8f264adc64630a42fc22878b4b13ca8e1723b5a791e9f9b11ef8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / hubspot_python-1.0.3-py3-none-any.whl
| Download URL | hubspot_python-1.0.3-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
746c1e0ed9f0ce7bcceff232ba8f0ce496d5dedcab6f4aac420b7c2dcbfffe6d
|
|
BLAKE2b-256 checksum How to use checksums |
f45c8e15b3a7cc80e9d29ed22eb26c5d88de190aec1eaced5d4c89ce7447b82e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for hubspot-python 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.