mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
highway to the danger_mode
This commit is contained in:
@@ -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
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user