Allow requests up to 0.8 and greater
The requests module dropped all configuration with the 1.0.0 release. There's no danger_mode and no 'verbose'' mode. The former shouldn't be necessary anymore and the latter can be done by setting a different log handler for the request.logging root logger. Change-Id: I41bfaf2574f6d7fc21f86e0124ceae7df6481eee Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
@@ -50,10 +50,6 @@ class HTTPClient(object):
|
|||||||
|
|
||||||
USER_AGENT = 'python-keystoneclient'
|
USER_AGENT = 'python-keystoneclient'
|
||||||
|
|
||||||
requests_config = {
|
|
||||||
'danger_mode': False,
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, username=None, tenant_id=None, tenant_name=None,
|
def __init__(self, username=None, tenant_id=None, tenant_name=None,
|
||||||
password=None, auth_url=None, region_name=None, timeout=None,
|
password=None, auth_url=None, region_name=None, timeout=None,
|
||||||
endpoint=None, token=None, cacert=None, key=None,
|
endpoint=None, token=None, cacert=None, key=None,
|
||||||
@@ -121,7 +117,8 @@ class HTTPClient(object):
|
|||||||
ch = logging.StreamHandler()
|
ch = logging.StreamHandler()
|
||||||
_logger.setLevel(logging.DEBUG)
|
_logger.setLevel(logging.DEBUG)
|
||||||
_logger.addHandler(ch)
|
_logger.addHandler(ch)
|
||||||
self.requests_config['verbose'] = sys.stderr
|
if hasattr(requests, logging):
|
||||||
|
requests.logging.getLogger(requests.__name__).addHandler(ch)
|
||||||
|
|
||||||
# keyring setup
|
# keyring setup
|
||||||
self.use_keyring = use_keyring and keyring_available
|
self.use_keyring = use_keyring and keyring_available
|
||||||
@@ -336,7 +333,6 @@ class HTTPClient(object):
|
|||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
verify=self.verify_cert,
|
verify=self.verify_cert,
|
||||||
config=self.requests_config,
|
|
||||||
**request_kwargs)
|
**request_kwargs)
|
||||||
|
|
||||||
self.http_log_resp(resp)
|
self.http_log_resp(resp)
|
||||||
|
@@ -327,8 +327,7 @@ class ShellTest(utils.TestCase):
|
|||||||
request_mock.assert_called_with(mock.ANY, mock.ANY,
|
request_mock.assert_called_with(mock.ANY, mock.ANY,
|
||||||
timeout=2,
|
timeout=2,
|
||||||
headers=mock.ANY,
|
headers=mock.ANY,
|
||||||
verify=mock.ANY,
|
verify=mock.ANY)
|
||||||
config=mock.ANY)
|
|
||||||
|
|
||||||
def test_do_endpoints(self):
|
def test_do_endpoints(self):
|
||||||
do_shell_mock = mock.MagicMock()
|
do_shell_mock = mock.MagicMock()
|
||||||
|
@@ -17,7 +17,6 @@ class TestCase(testtools.TestCase):
|
|||||||
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
||||||
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
|
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
|
||||||
TEST_REQUEST_BASE = {
|
TEST_REQUEST_BASE = {
|
||||||
'config': {'danger_mode': False},
|
|
||||||
'verify': True,
|
'verify': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +93,6 @@ class UnauthenticatedTestCase(testtools.TestCase):
|
|||||||
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
||||||
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
|
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
|
||||||
TEST_REQUEST_BASE = {
|
TEST_REQUEST_BASE = {
|
||||||
'config': {'danger_mode': False},
|
|
||||||
'verify': True,
|
'verify': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,7 +40,6 @@ class TestCase(testtools.TestCase):
|
|||||||
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
||||||
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v3')
|
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v3')
|
||||||
TEST_REQUEST_BASE = {
|
TEST_REQUEST_BASE = {
|
||||||
'config': {'danger_mode': False},
|
|
||||||
'verify': True,
|
'verify': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +69,6 @@ class UnauthenticatedTestCase(testtools.TestCase):
|
|||||||
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
|
||||||
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v3')
|
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v3')
|
||||||
TEST_REQUEST_BASE = {
|
TEST_REQUEST_BASE = {
|
||||||
'config': {'danger_mode': False},
|
|
||||||
'verify': True,
|
'verify': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
argparse
|
argparse
|
||||||
iso8601>=0.1.4
|
iso8601>=0.1.4
|
||||||
prettytable
|
prettytable
|
||||||
requests>=0.8.8,<1.0
|
requests>=0.8.8
|
||||||
simplejson
|
simplejson
|
||||||
|
Reference in New Issue
Block a user