Skip to content

POST + file + auth #7

@flaper87

Description

@flaper87

Hi,

I'm trying to send a post request with a file which requires an authentication...

Following the docs I do:

requests.post(url, files={"file" : open("filename")}, auth=my_auth_object)

Unfortunately I'm getting this error:

File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 383, in open
response = self._open(req, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 401, in _open
'_open', req)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 361, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1130, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1102, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 874, in request
self._send_request(method, url, body, headers)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 914, in _send_request
self.send(body)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 719, in send
self.sock.sendall(str)
File "/opt/virtualenvs/brainaetic/lib/python2.6/site-packages/eventlet/greenio.py", line 287, in sendall
tail = self.send(data, flags)
File "/opt/virtualenvs/brainaetic/lib/python2.6/site-packages/eventlet/greenio.py", line 265, in send
len_data = len(data)
AttributeError: multipart_yielder instance has no attribute 'len'

Ideas?

P.S: I'f I remove the auth the request doesn't fail but obviously the auth is required in my case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions