I am trying to send an excel file to server in POST Request in multipart/form-data content-type. I am getting an error:
too many values to unpack
What could be the reason? Below is the request what I am trying:
#Data = get_data('C:\foo.xls')
#print Data
Data = open('C:\foo.xls', 'rb')
print Data
headers = {
'access-control-allow-origin': '*',
'accept': 'application/json',
'content-type': 'multipart/form-data',
'authorization': 'Basic xxxxxxxxx'
}
R = requests.post('http://testserver:8080/v1/readyapi/executions/'+executionId+'/files', headers=headers, params=params, files=Data)
print R.content
here is the error:
Traceback (most recent call last):
(body, content_type) = self._encode_files(files, data)
File "C:\Python27\lib\site-packages\requests\models.py", line 132, in _encode_files
for (k, v) in files:
ValueError: too many values to unpack
I could not figure out by myself. tried few things, didn't work. Can someone please advise?