Add support for response.raw attribute.
Response objects in requests are documented to contain a raw attribute that is a file-like object. When the request is made with stream=True, the raw attribute can be read to stream in the content. Otherwise, the raw attribute looks like a file-like object with no bytes left to read.
This PR adds support for the raw attribute and its behavior (at least how requests behaves currently).
I feel this implementation is incorrect. It should use BytesIO and not StringIO, so that r.raw.read() returns bytes on Python 3.
I'm working on a patch for it.
You are correct. I should have used BytesIO for Python 2 and 3 compatibility.
Any news here? ;)