highway to the danger_mode

This commit is contained in:
Bryan Helmig
2012-01-05 12:50:44 -06:00
parent 115b51e68c
commit 459a91c54f
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ Configurations:
:decode_unicode: Decode unicode responses automatically?
:keep_alive: Reuse HTTP Connections?
:max_retries: The number of times a request should be retried in the event of a connection failure.
:eager_mode: If true, Requests will raise errors immediately.
:danger_mode: If true, Requests will raise errors immediately.
:safe_mode: If true, Requests will catch all errors.
:pool_maxsize: The maximium size of an HTTP connection pool.
:pool_connections: The number of active HTTP connection pools to use.
@@ -39,6 +39,6 @@ defaults['decode_unicode'] = True
defaults['pool_connections'] = 10
defaults['pool_maxsize'] = 10
defaults['max_retries'] = 0
defaults['eager_mode'] = False
defaults['danger_mode'] = False
defaults['safe_mode'] = False
defaults['keep_alive'] = True
+1 -1
View File
@@ -526,7 +526,7 @@ class Request(object):
# Save the response.
self.response.content
if self.config.get('eager_mode'):
if self.config.get('danger_mode'):
self.response.raise_for_status()
return self.sent
+1 -1
View File
@@ -280,7 +280,7 @@ class RequestsTestSuite(unittest.TestCase):
def test_default_status_raising(self):
config = {'eager_mode': True}
config = {'danger_mode': True}
args = [httpbin('status', '404')]
kwargs = dict(config=config)
self.assertRaises(HTTPError, requests.get, *args, **kwargs)