I would like to attach files to confluence from the rest API using Python with Oauth.
I was trying with the code below but I get the following error message
Unsupported Media Type
description
The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.
fileinfo = open(filename, 'rb')
files = {
'file': fileinfo}
headers = {'X-Atlassian-Token': 'no-check'}
headers['Content-Type'] = 'text/plain'
url = self._get_url('content/'+str(contentId) + "/child/attachment")
r = self._session.post(
url, files=files, headers=headers)
#Where _session is my ResilientSession with Oauth info already setup