Safer error response handling.

This commit is contained in:
Kenneth Reitz
2011-02-21 14:36:41 -05:00
parent 68dea921e7
commit e788ca7ee6
+3 -3
View File
@@ -134,10 +134,10 @@ class Request(object):
def _build_response(self, resp):
"""Build internal Response object from given response."""
self.response.status_code = resp.code
self.response.headers = resp.info().dict
self.response.status_code = getattr(resp, 'code', None)
self.response.headers = getattr(resp.info(), 'dict', None)
self.response.url = getattr(resp, 'url', None)
self.response.content = resp.read()
self.response.url = resp.url
def send(self, anyway=False):