Closed
Description
Hello,
Working with Mezzanine's current master (with the Python 3 support) I'm ran into an issue where Requests was mysteriously straight-up broken - every get request raised an AttributeError.
To replicate: make a new virtualenv, install future and requests, then:
Python 2.7.5 (default, Sep 2 2013, 05:24:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from future import standard_library
>>> import requests
>>> requests.get('http://www.google.com/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/al/venvs/future-test/lib/python2.7/site-packages/requests/api.py", line 55, in get
return request('get', url, **kwargs)
File "/Users/al/venvs/future-test/lib/python2.7/site-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/al/venvs/future-test/lib/python2.7/site-packages/requests/sessions.py", line 361, in request
resp = self.send(prep, **send_kwargs)
File "/Users/al/venvs/future-test/lib/python2.7/site-packages/requests/sessions.py", line 464, in send
r = adapter.send(request, **kwargs)
File "/Users/al/venvs/future-test/lib/python2.7/site-packages/requests/adapters.py", line 369, in send
r = self.build_response(request, resp)
File "/Users/al/venvs/future-test/lib/python2.7/site-packages/requests/adapters.py", line 179, in build_response
extract_cookies_to_jar(response.cookies, req, resp)
File "/Users/al/venvs/future-test/lib/python2.7/site-packages/requests/cookies.py", line 117, in extract_cookies_to_jar
jar.extract_cookies(res, req)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cookielib.py", line 1642, in extract_cookies
for cookie in self.make_cookies(response, request):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cookielib.py", line 1559, in make_cookies
rfc2965_hdrs = headers.getheaders("Set-Cookie2")
AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
Don't really know enough about future to know exactly what the problem is, but I assume requests is getting a future
library internally where it expects the standard Python 2 library. Could it be something to do with the lack of support for http.cookies?
Should the import be behaving like that? Can it be limited to the file it's written in?