python爬虫:无视https的CA安全认证

import urllib.request
import ssl

context = ssl._create_unverified_context()

url = 'https://www.12306.cn/mormhweb/'

request = urllib.request.Request(url)
response = urllib.request.urlopen(url = request, context=context)
print (response.read().decode('utf-8'))

你可能感兴趣的:(python爬虫:无视https的CA安全认证)