def https_open(self, req):
    return self.do_open(self.getConnection, req)

def getConnection(self, host):
    return httplib.HTTPSConnection(host, key_file=self.key, cert_file=self.cert
        )
cert_handler = HTTPSClientAuthHandler(settings.PEMFILE, settings.
    CLIENT_CERT_FILE)
opener = urllib.request.build_opener(cert_handler)
urllib.request.install_opener(opener)
f = urllib.request.urlopen('https://sampleapiserver.com')
print(f.code)
использование pyOpenSSL для создания пользовательского открывателя urllib