import urllib2 import ssl def test1(): print "*"*32 opener = urllib2.build_opener(urllib2.HTTPSHandler(debuglevel=1)) urllib2.install_opener(opener) print "============This gonna work====================" data = urllib2.urlopen('https://google.com').read() print "============This won't====================" data = urllib2.urlopen('https://google.com', context=ssl._create_unverified_context()).read() def test2(): print "*"*32 class MyHTTPSHandler(urllib2.HTTPSHandler): def https_open(self, req): print "Hello from custom handler - %s" % req.get_full_url() return urllib2.HTTPSHandler.https_open(self, req) opener = urllib2.build_opener(MyHTTPSHandler) urllib2.install_opener(opener) print "============This gonna work====================" data = urllib2.urlopen('https://google.com').read() print "============This won't====================" data = urllib2.urlopen('https://google.com', context=ssl._create_unverified_context()).read() if __name__ == '__main__': test1() test2() # 'cafile', 'capath', 'cadefault' paramerers have the same issue demonstrated 'context' parameter has