ORM like SDK to interact with APIs
Project description
Hubspot SDK
Providing a top level interface to perform crud operations on the hubspot interface.
Getting Started
Install the hubspot sdk
pip install hubspot-sdk
This version only supports authentication by setting the env variable
HUBSPOT_TOKEN=<super_secret_token>
Since the hubspot crm allows for a lot of customizations on properties and object types the sdk comes with a cli tool to map the hubspot properties to python objects. To get started run set up script. This will create a new python module at the target path with the property mapping for Contacts, Companies, Leads and Deals from the hubspot account associated with the provided token. All properties with a distinct value selection (i.e. Single Selects, Multi Selects, Pipeline Stages etc.) will be represented by a corresponding helper class.
hubspot_sdk init target_dir
To update mappings rerun the above command.
How to use the SDK
Fetching objects (works for all types the same way):
from target_dir import Contact
# this will cause a NonUniqueObjectError if more than one contact is fetched
contact = Contact.get_unique(email="test@me.com")
# this will return None if the contact is not found or more than one contact is found.
contact = Contact.one_or_none(email="test@me.com")
# this will return a list of contact objects or an empty list, there is an optional filter parameter to
# get specific objects
contacts = Contact.get()
# synonym to get:
contacts = Contact.list()
There are 2 methods to update a property on an object:
from target_dir import Contact
# this will cause a NonUniqueObjectError if more than one contact is fetched
contact = Contact.get_unique(email="test@me.com")
contact.props.name = "John Doe"
# alternatively
contact.props["name"] = "John Doe"
# this will save changes to hubspot.
contact.update()
# this deletes the user from hubspot
contact.delete()
To delete a contact simply run Contact.delete(id='123456')
To create a new contact you could simply create a new contact instance and call the contact.update() method. This
will either update an existing user or create a new one.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_api_orm-0.1.0.tar.gz.
File metadata
- Download URL: py_api_orm-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0892d269b53a445652bda21018aea78941fe97abc7c7a8b773b82da28fa7b911
|
|
| MD5 |
db4d01914bedbc13745bfa727e58c365
|
|
| BLAKE2b-256 |
8069836e39a2cbdfd25e9de32930755310fa1505fc3490675e06dda688a90516
|
File details
Details for the file py_api_orm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_api_orm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c90ea1d85a1ab5eab20278f2b985531ae74ac457ab9f0c08e80c96759d8ad477
|
|
| MD5 |
73fbf6886928d09ff4c1dbc531f28954
|
|
| BLAKE2b-256 |
c224e82d5f6aff99b78a5e4979b68ccd566b23966c0783db960dd656893461cb
|