@@ -18,7 +18,7 @@ pip install --upgrade hubspot-api-client
1818
1919### Requirements
2020
21- Make sure you have [ Python 3.5 +] ( https://docs.python.org/3/ ) and [ pip] ( https://pypi.org/project/pip/ ) installed.
21+ Make sure you have [ Python 3.7 +] ( https://docs.python.org/3/ ) and [ pip] ( https://pypi.org/project/pip/ ) installed.
2222
2323
2424## Quickstart
@@ -162,7 +162,66 @@ try:
162162except ApiException as e:
163163 print (" Exception when calling cards_api->create: %s \n " % e)
164164```
165+ ## Not wrapped endpoint(s)
165166
167+ It is possible to access the hubspot request method directly,
168+ it could be handy if client doesn't have implementation for some endpoint yet.
169+ Exposed request method benefits by having all configured client params.
170+
171+ ``` python
172+ client.api_request({
173+ " method" : " PUT" ,
174+ " path" : " /some/api/not/wrapped/yet" ,
175+ " body" : {" key" : " value" }
176+ })
177+ ```
178+
179+ ### {Example} for ` GET ` request
180+
181+ ``` python
182+ import hubspot
183+ from pprint import pprint
184+ from hubspot.crm.contacts import ApiException
185+
186+ client = hubspot.Client.create(access_token = " your_access_token" )
187+
188+ try :
189+ response = client.api_request(
190+ {" path" : " /crm/v3/objects/contacts" }
191+ )
192+ pprint(response)
193+ except ApiException as e:
194+ print (e)
195+ ```
196+
197+ ### {Example} for ` POST ` request
198+
199+ ``` python
200+ import hubspot
201+ from pprint import pprint
202+ from hubspot.crm.contacts import ApiException
203+
204+ client = hubspot.Client.create(access_token = " your_access_token" )
205+
206+ try :
207+ response = client.api_request(
208+ {
209+ " path" : " /crm/v3/objects/contacts" ,
210+ " method" : " POST" ,
211+ " body" : {
212+ " properties" :
213+ {
214+ 215+ " lastname" : " some_last_name"
216+ },
217+ }
218+ }
219+
220+ )
221+ pprint(response.json())
222+ except ApiException as e:
223+ print (e)
224+ ```
166225### Using utils
167226
168227#### Get OAuth url:
@@ -183,8 +242,6 @@ auth_url = get_auth_url(
183242
184243``` python
185244import os
186-
187- from datetime import datetime
188245from flask import request
189246from hubspot.utils.signature import Signature
190247
@@ -194,7 +251,7 @@ Signature.is_valid(
194251 request_body = request.data.decode(" utf-8" ),
195252 http_uri = request.base_url,
196253 signature_version = request.headers[" X-HubSpot-Signature-Version" ],
197- timestamp = datetime.now().timestamp()
254+ timestamp = request.headers[ " X-HubSpot-Request-Timestamp " ]
198255)
199256```
200257
0 commit comments