Skip to content

Commit

Permalink
Update to requests >= 0.8
Browse files Browse the repository at this point in the history
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: Iec169ef6e39097814cdbf1b777bc0590236692ba
  • Loading branch information
saschpe committed Feb 11, 2013
1 parent 1ea7e65 commit c73afa9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
8 changes: 2 additions & 6 deletions novaclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ class HTTPClient(object):

USER_AGENT = 'python-novaclient'

requests_config = {
'danger_mode': False,
}

def __init__(self, user, password, projectid, auth_url=None,
insecure=False, timeout=None, proxy_tenant_id=None,
proxy_token=None, region_name=None,
Expand Down Expand Up @@ -104,7 +100,8 @@ def __init__(self, user, password, projectid, auth_url=None,
ch = logging.StreamHandler()
self._logger.setLevel(logging.DEBUG)
self._logger.addHandler(ch)
self.requests_config['verbose'] = sys.stderr
if hasattr(requests, logging):
requests.logging.getLogger(requests.__name__).addHandler(ch)

def use_token_cache(self, use_it):
self.os_cache = use_it
Expand Down Expand Up @@ -167,7 +164,6 @@ def request(self, url, method, **kwargs):
method,
url,
verify=self.verify_cert,
config=self.requests_config,
**kwargs)
self.http_log_resp(resp)

Expand Down
3 changes: 1 addition & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def test_client_with_timeout(self):
requests.request.assert_called_with(mock.ANY, mock.ANY,
timeout=2,
headers=mock.ANY,
verify=mock.ANY,
config=mock.ANY)
verify=mock.ANY)

def test_get_client_class_v2(self):
output = novaclient.client.get_client_class('2')
Expand Down
1 change: 0 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class TestCase(testtools.TestCase):
TEST_REQUEST_BASE = {
'config': {'danger_mode': False},
'verify': True,
}

Expand Down
2 changes: 1 addition & 1 deletion tools/pip-requires
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
argparse
iso8601>=0.1.4
prettytable>=0.6,<0.7
requests<1.0
requests>=0.8
simplejson

0 comments on commit c73afa9

Please sign in to comment.