Bases: httplib.HTTPSConnection
Variant of httplib.HTTPSConnection that validates server certificates and checks that the hostname matches the certificate.
>>> class ConfiguredValidatingHTTPSConnection(ValidatingHTTPSConnection):
... ca_certs = '/etc/pki/tls/cert.pem'
>>> opener = urllib2.build_opener(ConfiguredValidatingHTTPSConnection.HTTPSHandler)
>>> fh = opener.open('https://validcertsite/')
>>> fh = opener.open('https://invalidcertsite/')
urllib2.URLError: <urlopen error (1, '_ssl.c:485: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed')>
>>> fh = opener.open('https://validcertsitewithhostnamethatdoesnotmatch/')
urllib2.URLError: <urlopen error Name 'validcertsitewithhostnamethatdoesnotmatch' does not match any of these certificate names: ['pleasecallmegeorge']>
Parameters: |
|
---|---|
Raises: | NotImplementedError if the ssl module is not available |
descriptor to generate a urllib2.HTTPSHandler that uses the containing HTTPSConnection class