projects
/
services
/
python-requests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
68dea92
)
Safer error response handling.
author
Kenneth Reitz
<me@kennethreitz.com>
Mon, 21 Feb 2011 19:36:41 +0000
(14:36 -0500)
committer
Kenneth Reitz
<me@kennethreitz.com>
Mon, 21 Feb 2011 19:36:41 +0000
(14:36 -0500)
requests/core.py
patch
|
blob
|
history
diff --git
a/requests/core.py
b/requests/core.py
index
9292a9a
..
3f599b1
100644
(file)
--- 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):