Skip to content

Commit ea94370

Browse files
Merge pull request #376 from HubSpot/feature/update-readme
Add example how upload files
2 parents d19a809 + fab18b9 commit ea94370

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,36 @@ try:
162162
except ApiException as e:
163163
print("Exception when calling cards_api->create: %s\n" % e)
164164
```
165+
166+
### Files API
167+
168+
#### Upload files:
169+
```python
170+
import hubspot
171+
import json
172+
from pprint import pprint
173+
from hubspot.crm.contacts import ApiException
174+
175+
client = hubspot.Client.create(access_token="your_access_token")
176+
177+
options = json.dumps(
178+
{'access': 'PRIVATE',
179+
"overwrite": False}
180+
)
181+
182+
try:
183+
response = client.files.files_api.upload(
184+
file="/file/path/file.jpeg",
185+
file_name="name_in_hubspot",
186+
folder_path="folder_in_hubspot",
187+
options=options,
188+
)
189+
pprint(response)
190+
191+
except ApiException as e:
192+
print("Exception when calling basic_api->get_page: %s\n" % e)
193+
```
194+
165195
## Not wrapped endpoint(s)
166196

167197
It is possible to access the hubspot request method directly,

0 commit comments

Comments
 (0)