PythonConfluenceAPI icon indicating copy to clipboard operation
PythonConfluenceAPI copied to clipboard

ValueError with attachment list

Open macotine opened this issue 9 years ago • 0 comments

It appears when I pass a list of dictionaries to create_new_attachment_by_content_id I get an assertion error when the request is built.

The structure of the list is: [{'file': file1}, {'file': file2}, {'file': file3}]

Stack trace:

self.confluence.create_new_attachment_by_content_id(content_id, attachments)
  File "C:\dev\Python27\lib\site-packages\pythonconfluenceapi-0.0.1rc4-py2.7.egg\PythonConfluenceAPI\api.py", line 813, in create_new_attachment_by_content_id
  File "C:\dev\Python27\lib\site-packages\pythonconfluenceapi-0.0.1rc4-py2.7.egg\PythonConfluenceAPI\api.py", line 133, in _service_post_request
  File "C:\dev\Python27\lib\site-packages\pythonconfluenceapi-0.0.1rc4-py2.7.egg\PythonConfluenceAPI\api.py", line 109, in _service_request
  File "C:\dev\Python27\lib\site-packages\requests\sessions.py", line 451, in request
    prep = self.prepare_request(req)
  File "C:\dev\Python27\lib\site-packages\requests\sessions.py", line 382, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "C:\dev\Python27\lib\site-packages\requests\models.py", line 307, in prepare
    self.prepare_body(data, files, json)
  File "C:\dev\Python27\lib\site-packages\requests\models.py", line 453, in prepare_body
    (body, content_type) = self._encode_files(files, data)
  File "C:\dev\Python27\lib\site-packages\requests\models.py", line 132, in _encode_files
    for (k, v) in files:
ValueError: need more than 1 value to unpack

macotine avatar Nov 11 '16 21:11 macotine