Hi @PedroTayer,
2 things, first you don’t want to specify the content type, because for multipart/form-data encoding that contains the boundary and you are overwriting that, and secondly you want to use the files parameter for the post function to tell requests to do multipart/form-data. Here is some sample code I got working:
import json, requests, os
BEARER_TOKEN = os.environ['BEARER_TOKEN']
headers = {'authorization': "Bearer " + BEARER_TOKEN}
url = 'https://api.hubapi.com/files/v3/files'
with open("test.txt") as fh:
files = {'file': fh}
data = {
'folderId': '',
'fileName': 'testFileName',
'options': json.dumps({
'access': 'PRIVATE',
'overwrite': False,
'duplicateValidationStrategy': 'NONE',
'duplicateValidationScope': 'EXACT_FOLDER'
})
}
resp = requests.post(url, files=files, data=data, headers=headers)
Best,