Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more style fixes

  • Loading branch information...
commit 89253689c384a7aa67aba027351f9d6f3b22fdcb 1 parent 10ee82d
@t-8ch t-8ch authored
Showing with 20 additions and 20 deletions.
  1. +8 −8 test/with_dummyserver/test_https.py
  2. +12 −12 urllib3/connectionpool.py
View
16 test/with_dummyserver/test_https.py
@@ -137,38 +137,38 @@ def test_set_ssl_version_to_sslv3(self):
self._pool.ssl_version = ssl.PROTOCOL_SSLv3
self.assertRaises(SSLError, self._pool.request, 'GET', '/')
- def test_verify_specific_hostname(self):
+ def test_assert_specific_hostname(self):
https_pool = HTTPSConnectionPool('127.0.0.1', self.port,
cert_reqs='CERT_REQUIRED')
https_pool.ca_certs = DEFAULT_CA
- https_pool.verify_hostname = 'localhost'
+ https_pool.assert_hostname = 'localhost'
https_pool.request('GET', '/')
- def test_verify_fingerprint_md5(self):
+ def test_assert_fingerprint_md5(self):
https_pool = HTTPSConnectionPool('127.0.0.1', self.port,
cert_reqs='CERT_REQUIRED')
https_pool.ca_certs = DEFAULT_CA
- https_pool.verify_fingerprint = 'CA:84:E1:AD0E5a:ef:2f:C3:09' \
+ https_pool.assert_fingerprint = 'CA:84:E1:AD0E5a:ef:2f:C3:09' \
':E7:30:F8:CD:C8:5B'
https_pool.request('GET', '/')
- def test_verify_fingerprint_sha1(self):
+ def test_assert_fingerprint_sha1(self):
https_pool = HTTPSConnectionPool('127.0.0.1', self.port,
cert_reqs='CERT_REQUIRED')
https_pool.ca_certs = DEFAULT_CA
- https_pool.verify_fingerprint = 'CC:45:6A:90:82:F7FF:C0:8218:8e:' \
+ https_pool.assert_fingerprint = 'CC:45:6A:90:82:F7FF:C0:8218:8e:' \
'7A:F2:8A:D7:1E:07:33:67:DE'
https_pool.request('GET', '/')
- def test_verify_invalid_fingerprint(self):
+ def test_assert_invalid_fingerprint(self):
https_pool = HTTPSConnectionPool('127.0.0.1', self.port,
cert_reqs='CERT_REQUIRED')
https_pool.ca_certs = DEFAULT_CA
- https_pool.verify_fingerprint = 'AA:AA:AA:AA:AA:AAAA:AA:AAAA:AA:' \
+ https_pool.assert_fingerprint = 'AA:AA:AA:AA:AA:AAAA:AA:AAAA:AA:' \
'AA:AA:AA:AA:AA:AA:AA:AA:AA'
self.assertRaises(SSLError,
View
24 urllib3/connectionpool.py
@@ -82,14 +82,14 @@ class VerifiedHTTPSConnection(HTTPSConnection):
def set_cert(self, key_file=None, cert_file=None,
cert_reqs=None, ca_certs=None,
- verify_hostname=None, verify_fingerprint=None):
+ assert_hostname=None, assert_fingerprint=None):
self.key_file = key_file
self.cert_file = cert_file
self.cert_reqs = cert_reqs
self.ca_certs = ca_certs
- self.verify_hostname = verify_hostname
- self.verify_fingerprint = verify_fingerprint
+ self.assert_hostname = assert_hostname
+ self.assert_fingerprint = assert_fingerprint
def connect(self):
# Add certificate verification
@@ -107,12 +107,12 @@ def connect(self):
ssl_version=resolved_ssl_version)
if resolved_cert_reqs != ssl.CERT_NONE:
- if self.verify_fingerprint:
+ if self.assert_fingerprint:
assert_fingerprint(self.sock.getpeercert(binary_form=True),
- self.verify_fingerprint)
+ self.assert_fingerprint)
else:
match_hostname(self.sock.getpeercert(),
- self.verify_hostname or self.host)
+ self.assert_hostname or self.host)
## Pool objects
@@ -510,7 +510,7 @@ class HTTPSConnectionPool(HTTPConnectionPool):
instead of :class:`httplib.HTTPSConnection`.
The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``,
- ``ssl_version``, ``verify_hostname`` and ``verify_fingerprint``
+ ``ssl_version``, ``assert_hostname`` and ``assert_fingerprint``
are only used if :mod:`ssl` is available and are fed into
:meth:`urllib3.util.ssl_wrap_socket` to upgrade the connection socket
into an SSL socket.
@@ -523,7 +523,7 @@ def __init__(self, host, port=None,
block=False, headers=None,
key_file=None, cert_file=None, cert_reqs=None,
ca_certs=None, ssl_version=None,
- verify_hostname=None, verify_fingerprint=None):
+ assert_hostname=None, assert_fingerprint=None):
HTTPConnectionPool.__init__(self, host, port,
strict, timeout, maxsize,
@@ -533,8 +533,8 @@ def __init__(self, host, port=None,
self.cert_reqs = cert_reqs
self.ca_certs = ca_certs
self.ssl_version = ssl_version
- self.verify_hostname = verify_hostname
- self.verify_fingerprint = verify_fingerprint
+ self.assert_hostname = assert_hostname
+ self.assert_fingerprint = assert_fingerprint
def _new_conn(self):
"""
@@ -558,8 +558,8 @@ def _new_conn(self):
strict=self.strict)
connection.set_cert(key_file=self.key_file, cert_file=self.cert_file,
cert_reqs=self.cert_reqs, ca_certs=self.ca_certs,
- verify_hostname=self.verify_hostname,
- verify_fingerprint=self.verify_fingerprint)
+ assert_hostname=self.assert_hostname,
+ assert_fingerprint=self.assert_fingerprint)
connection.ssl_version = self.ssl_version
Please sign in to comment.
Something went wrong with that request. Please try again.