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:
Chuck Short
2013-02-06 09:36:51 -06:00
parent ff24716d09
commit b998ff9252
5 changed files with 4 additions and 13 deletions

View File

@@ -50,10 +50,6 @@ class HTTPClient(object):
USER_AGENT = 'python-keystoneclient'
requests_config = {
'danger_mode': False,
}
def __init__(self, username=None, tenant_id=None, tenant_name=None,
password=None, auth_url=None, region_name=None, timeout=None,
endpoint=None, token=None, cacert=None, key=None,
@@ -121,7 +117,8 @@ class HTTPClient(object):
ch = logging.StreamHandler()
_logger.setLevel(logging.DEBUG)
_logger.addHandler(ch)
self.requests_config['verbose'] = sys.stderr
if hasattr(requests, logging):
requests.logging.getLogger(requests.__name__).addHandler(ch)
# keyring setup
self.use_keyring = use_keyring and keyring_available
@@ -336,7 +333,6 @@ class HTTPClient(object):
method,
url,
verify=self.verify_cert,
config=self.requests_config,
**request_kwargs)
self.http_log_resp(resp)

View File

@@ -327,8 +327,7 @@ class ShellTest(utils.TestCase):
request_mock.assert_called_with(mock.ANY, mock.ANY,
timeout=2,
headers=mock.ANY,
verify=mock.ANY,
config=mock.ANY)
verify=mock.ANY)
def test_do_endpoints(self):
do_shell_mock = mock.MagicMock()

View File

@@ -17,7 +17,6 @@ class TestCase(testtools.TestCase):
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
TEST_REQUEST_BASE = {
'config': {'danger_mode': False},
'verify': True,
}
@@ -94,7 +93,6 @@ class UnauthenticatedTestCase(testtools.TestCase):
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v2.0')
TEST_REQUEST_BASE = {
'config': {'danger_mode': False},
'verify': True,
}

View File

@@ -40,7 +40,6 @@ class TestCase(testtools.TestCase):
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v3')
TEST_REQUEST_BASE = {
'config': {'danger_mode': False},
'verify': True,
}
@@ -70,7 +69,6 @@ class UnauthenticatedTestCase(testtools.TestCase):
TEST_ROOT_ADMIN_URL = 'http://127.0.0.1:35357/'
TEST_ADMIN_URL = '%s%s' % (TEST_ROOT_ADMIN_URL, 'v3')
TEST_REQUEST_BASE = {
'config': {'danger_mode': False},
'verify': True,
}

View File

@@ -1,5 +1,5 @@
argparse
iso8601>=0.1.4
prettytable
requests>=0.8.8,<1.0
requests>=0.8.8
simplejson