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:
7c5151e
)
catch TooManyRedirects in safe_mode
author
miguel
<miguel@immunityinc.com>
Fri, 3 Feb 2012 19:16:23 +0000
(14:16 -0500)
committer
Shivaram Lingamneni
<slingamn@cs.stanford.edu>
Wed, 2 May 2012 00:00:19 +0000
(17:00 -0700)
requests/models.py
patch
|
blob
|
history
diff --git
a/requests/models.py
b/requests/models.py
index
c11858b
..
be6a4ed
100644
(file)
--- a/
requests/models.py
+++ b/
requests/models.py
@@
-631,7
+631,15
@@
class Request(object):
else:
raise
- self._build_response(r)
+ # build_response can throw TooManyRedirects
+ try:
+ self._build_response(r)
+ except RequestException as e:
+ if self.config.get('safe_mode', False):
+ # In safe mode, catch the exception
+ self.response.error = e
+ else:
+ raise
# Response manipulation hook.
self.response = dispatch_hook('response', self.hooks, self.response)