kennethreitz/requests — pull request #1802 by kevinburke (2013-12-16 05:41:53+00:00)
Title: Add as_http() method to print out HTTP response as a string

When a HTTP response doesn't contain the content that I expect, most times I find that the simplest debugging information I want is the actual HTTP content that was sent over the wire. Instead of having to construct all of this manually I thought it would be nice to add this information as a convenience `as_http()` request.

Example:

```python
>>> requests.get('https://api.twilio.com/2010-04-01.json')

>>> print r.as_http()
HTTP/1.1 200 OK
content-length: 109
x-powered-by: AT-5000
connection: close
etag:
date: Mon, 16 Dec 2013 05:39:55 GMT
x-shenanigans: none
access-control-allow-origin: https://www.twilio.com
content-type: application/json

{"name":"2010-04-01","uri":"\/2010-04-01.json","subresource_uris":{"accounts":"\/2010-04-01\/Accounts.json"}}
```

This PR also passes through version information as an attribute on the `Response` object, and adds tests for this method.