問題:urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificat
解決方法:1.使用ssl創(chuàng)建未經(jīng)驗證的上下文埃脏,在urlopen中傳入上下文參數(shù)
import ssl
import urllib2
context = ssl._create_unverified_context()
print urllib2.urlopen("https://www.111cn.net/", context=context).read()
2.導(dǎo)入ssl時關(guān)閉證書驗證
import ssl
import urllib2
ssl._create_default_https_context = ssl._create_unverified_context
print urllib2.urlopen("https://www.111cn.net/").read()