Closed nikhilgeo closed 7 years ago
I changed my code to the below:
headers = {'Accept': 'application/json', 'content-Type':'multipart/form-data'}
files = {'file': open(report, 'rb')}
url = "http://X.X.X.X:8080/threadfix/rest/applications/"+app_id+"/upload?apiKey=XXX"
r = requests.post(url, headers=headers, files=files)
data = json.loads(r.text)
print data
It now shows another error: {'message': 'Failed to parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found', 'object': None, 'responseCode': -1, 'success': False}
Any help is much appreciated.
I figured it out.
I removed 'content-Type':'multipart/form-data'
from the headers.
thanks anyways !!
I'm invoking the upload api from the python like below:
This gives me error {'message': 'Current request is not a multipart request', u'object': None, u'responseCode': -1, u'success': False}.
Any idea how to resolve this ..?