I am trying too upload a file through an API with Python. I have almost got it but i cant seem to get the data part right. The link shows how it works and my code is under. https://bimsync.com/developers/reference/api/v2#create-revision
How i should write the code to send the data?
def create_new_revision(self, project_id, model_id, filepath):
with open("API_INFO.json", "r") as jsonFile:
info = json.load(jsonFile)
headers = {
'Authorization': 'Bearer {}'.format(info["access_token"]),
'Content-Type': 'application/ifc',
"Bimsync-Params": {"callbackUri": "https://example.com",
"comment": "added some windows",
"filename": "mk.ifc",
"model": "{}".format(model_id)}}
files = open("mk.ifc", "rb")
data = {files, "mk.ifc"}
print(headers)
print("Createing new revision for model:")
requests.post(r'https://api.bimsync.com/v2/projects/{}/revisions'.format(project_id), headers=headers, data=data)