예제 #1
0
def opener_for(ca_bundle=None):
    """Get a urlopen() replacement that uses ca_bundle for verification"""
    return urllib2.build_opener(
        VerifyingHTTPSHandler(ca_bundle or find_ca_bundle())
    ).open
예제 #2
0
def opener_for(ca_bundle=None):
    """Get a urlopen() replacement that uses ca_bundle for verification"""
    return urllib2.build_opener(
        VerifyingHTTPSHandler(ca_bundle or find_ca_bundle())).open
예제 #3
0
        )
        try:
<<<<<<< HEAD
            match_hostname(self.sock.getpeercert(), self.host)
=======
            match_hostname(self.sock.getpeercert(), actual_host)
>>>>>>> 54eef0be98b1b67c8507db91f4cfa90b64991027
        except CertificateError:
            self.sock.shutdown(socket.SHUT_RDWR)
            self.sock.close()
            raise

def opener_for(ca_bundle=None):
    """Get a urlopen() replacement that uses ca_bundle for verification"""
<<<<<<< HEAD
    return urllib2.build_opener(
=======
    return urllib.request.build_opener(
>>>>>>> 54eef0be98b1b67c8507db91f4cfa90b64991027
        VerifyingHTTPSHandler(ca_bundle or find_ca_bundle())
    ).open


_wincerts = None

def get_win_certfile():
    global _wincerts
    if _wincerts is not None:
        return _wincerts.name

    try: