@@ -18,7 +18,7 @@ pip install --upgrade hubspot-api-client
18
18
19
19
### Requirements
20
20
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.
22
22
23
23
24
24
## Quickstart
@@ -162,7 +162,66 @@ try:
162
162
except ApiException as e:
163
163
print (" Exception when calling cards_api->create: %s \n " % e)
164
164
```
165
+ ## Not wrapped endpoint(s)
165
166
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
+ ```
166
225
### Using utils
167
226
168
227
#### Get OAuth url:
@@ -183,8 +242,6 @@ auth_url = get_auth_url(
183
242
184
243
``` python
185
244
import os
186
-
187
- from datetime import datetime
188
245
from flask import request
189
246
from hubspot.utils.signature import Signature
190
247
@@ -194,7 +251,7 @@ Signature.is_valid(
194
251
request_body = request.data.decode(" utf-8" ),
195
252
http_uri = request.base_url,
196
253
signature_version = request.headers[" X-HubSpot-Signature-Version" ],
197
- timestamp = datetime.now().timestamp()
254
+ timestamp = request.headers[ " X-HubSpot-Request-Timestamp " ]
198
255
)
199
256
```
200
257
0 commit comments