def ssl_checker(self, domain):
domain_fix = "https://{}".format(domain)
try:
# Skip SSL Verification Check!
# https://stackoverflow.com/questions/27835619/ssl-certificate-verify-failed-error
gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1) # Only for gangstars
data = urllib2.urlopen("https://{}".format(domain), timeout=25, context=gcontext)
if "ERROR" in data or "Errno" in data:
domain_fix = "http://{}".format(domain)
except urllib2.HTTPError, e:
pass
except urllib2.URLError, e:
domain_fix = "http://{}".format(domain)
except ssl.SSLError as e:
domain_fix = "http://{}".format(domain)
except httplib.BadStatusLine:
domain_fix = "http://{}".format(domain)
return domain_fix
评论列表
文章目录