From e788ca7ee629f7ed8700d31bbdf7a2930c1a7398 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 21 Feb 2011 14:36:41 -0500 Subject: [PATCH] Safer error response handling. --- requests/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requests/core.py b/requests/core.py index 9292a9a..3f599b1 100644 --- a/requests/core.py +++ b/requests/core.py @@ -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): -- 2.7.4