有点复杂,简言之就是我用Charles配了下电脑,然后模拟登陆拉勾网抓取https包,代码如下:
def getURLHTML(url):
headers = {
'Host': 'www.lagou.com',
'Referer': 'https://www.lagou.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0',
}
return requests.get(url, headers=headers).text
结果现在出现SSL错误,和cookie无关,我删了cookie也是这个错误:
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.lagou.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)'),))
有大佬请指条明路
试下添加以下代码: