Skip to content

Commit

Permalink
Merge pull request #363 from HubSpot/11.0.0
Browse files Browse the repository at this point in the history
11.0.0
  • Loading branch information
alzheltkovskiy-hubspot authored Nov 27, 2024
2 parents fbaa458 + 2c2a1a6 commit 3bb25a3
Show file tree
Hide file tree
Showing 92 changed files with 6,082 additions and 234 deletions.
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/HubSpot/hubspot-api-python/compare/v10.0.0...HEAD)
## [Unreleased](https://github.com/HubSpot/hubspot-api-python/compare/v11.0.0...HEAD)

## [11.0.0](https://github.com/HubSpot/hubspot-api-python/compare/v10.0.0...v11.0.0) - 2024-11-27

## Associations

- Added `assiciations.v4.report_api` Api.
- Added `assiciations.v4.schema.definition_configurations_api` Api.

## Marketing Events

- Added `marketing.events.list_associations_api` Api.
- Renamed method `create_by_contact_email` to `record_by_contact_emails` in `marketing.events.attendance_subscriber_state_changes_api`.
- Renamed method `create_by_contact_id` to `record_by_contact_ids` in `marketing.events.attendance_subscriber_state_changes_api`.
- Remove parameters `attendance_state_calculation_timestamp` and `import_status` to `marketing.events.models.marketing_event_update_request_params`.

## Other changes

- Added `api_request` Api(for requests by curl).
- Enhance `get_all` method.
- Added possibility change all configuration params("proxy", "proxy_headers" and ect.).
- Fix call `crm.tickets.merge_api`.
- Update README.
- Update requires.
- Update Makefile.

## [10.0.0](https://github.com/HubSpot/hubspot-api-python/compare/v9.0.0...v10.0.0) - 2024-10-10

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
VENV_NAME?=venv
VENV_NAME ?= venv

venv: $(VENV_NAME)/bin/activate

$(VENV_NAME)/bin/activate: setup.py
pip3 install --upgrade pip virtualenv
@test -d $(VENV_NAME) || python3 -m virtualenv --clear $(VENV_NAME)
${VENV_NAME}/bin/python -m pip install -e .[dev]
@test -d $(VENV_NAME) || python3 -m venv $(VENV_NAME)
@${VENV_NAME}/bin/python -m pip install --upgrade pip
@${VENV_NAME}/bin/python -m pip install -e .[dev]
@touch $(VENV_NAME)/bin/activate

test: venv
Expand Down
65 changes: 61 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip install --upgrade hubspot-api-client

### Requirements

Make sure you have [Python 3.5+](https://docs.python.org/3/) and [pip](https://pypi.org/project/pip/) installed.
Make sure you have [Python 3.7+](https://docs.python.org/3/) and [pip](https://pypi.org/project/pip/) installed.


## Quickstart
Expand Down Expand Up @@ -162,7 +162,66 @@ try:
except ApiException as e:
print("Exception when calling cards_api->create: %s\n" % e)
```
## Not wrapped endpoint(s)

It is possible to access the hubspot request method directly,
it could be handy if client doesn't have implementation for some endpoint yet.
Exposed request method benefits by having all configured client params.

```python
client.api_request({
"method": "PUT",
"path": "/some/api/not/wrapped/yet",
"body": {"key": "value"}
})
```

### {Example} for `GET` request

```python
import hubspot
from pprint import pprint
from hubspot.crm.contacts import ApiException

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

try:
response = client.api_request(
{"path": "/crm/v3/objects/contacts"}
)
pprint(response)
except ApiException as e:
print(e)
```

### {Example} for `POST` request

```python
import hubspot
from pprint import pprint
from hubspot.crm.contacts import ApiException

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

try:
response = client.api_request(
{
"path": "/crm/v3/objects/contacts",
"method": "POST",
"body": {
"properties":
{
"email": "[email protected]",
"lastname": "some_last_name"
},
}
}

)
pprint(response.json())
except ApiException as e:
print(e)
```
### Using utils

#### Get OAuth url:
Expand All @@ -183,8 +242,6 @@ auth_url = get_auth_url(

```python
import os

from datetime import datetime
from flask import request
from hubspot.utils.signature import Signature

Expand All @@ -194,7 +251,7 @@ Signature.is_valid(
request_body=request.data.decode("utf-8"),
http_uri=request.base_url,
signature_version=request.headers["X-HubSpot-Signature-Version"],
timestamp=datetime.now().timestamp()
timestamp=request.headers["X-HubSpot-Request-Timestamp"]
)
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.0.0
11.0.0
6 changes: 6 additions & 0 deletions hubspot/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from urllib3.util.retry import Retry


class Client:
def __init__(
self,
Expand Down Expand Up @@ -86,3 +87,8 @@ def settings(self):
def webhooks(self):
from .discovery.webhooks.discovery import Discovery as WebhooksDiscovery
return WebhooksDiscovery(self.config)

def api_request(self, options):
from .utils.requests.http_request_builder import Request
request = Request(self.config, options)
return request.send()
2 changes: 1 addition & 1 deletion hubspot/crm/associations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# flake8: noqa

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/api/batch_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/api_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/configuration.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# flake8: noqa
"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/associated_id.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/error.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/error_detail.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/next_page.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/paging.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/previous_page.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/public_association.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/public_object_id.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/models/standard_error.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/rest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations
Associations
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# flake8: noqa

"""
CRM Associations Schema
Associations Schema
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/schema/api/types_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

"""
CRM Associations Schema
Associations Schema
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion hubspot/crm/associations/schema/api_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
"""
CRM Associations Schema
Associations Schema
Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. # noqa: E501
Expand Down
Loading

0 comments on commit 3bb25a3

Please sign in to comment.