在python3(我用的是python3.5)如何登陆https的网站。
def login(loginurl,logindata):
cj = http.cookiejar.CookieJar()
pro = request.HTTPCookieProcessor(cj)
opener = request.build_opener(pro)
request.install_opener(opener)
req = request.Request(loginurl)
req.add_header('User-Aent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0')
resp = request.urlopen(req, logindata)
# htmlcontent = resp.read().decode('utf-8')
# print(htmlcontent)
login(loginurl,logindata)
用这种方法登陆http是可以获取登陆后的页面的,但是登陆https的网站,在执行该函数后,访问登陆后的页面时,提示无权限访问,未登陆。
怎解?