import requests
session = requests.session()
carProposalUrl = "www.caaaa.com.cn/aaaa/aaaaa/carProposalproposal.do"
carProposalHeaders ={
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding":"gzip, deflate, br",
"Accept-Language":"zh-CN,zh;q=0.8",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.7 Safari/537.36",
"Referer": "http://www.chinalife-p.com.cn/view/default/modal/insuranceCar.html",
"Upgrade-Insecure-Requests":"1",
"Connection":"keep-alive",
"Host":"www.chinalife.com.cn"","
}
carProposalUrlParams = {
"proposalArea": "3110000",
}
carProposal = session.get(carProposalUrl, params=carProposalUrlParams, headers=carProposalHeaders).text
print carProposal
requests.exceptions.MissingSchema: Invalid URL 'xxxxxxxxxxxxx': No schema supplied. Perhaps you meant xxxxxxxxxxxxx
在爬虫的时候遇到这个问题,然后是各种百度,还是不能发现原因,最后向老司机请教后,原来在carProposalUrl = "www.caaaa.com.cn/aaaa/aaaaa/carProposalproposal.do"中的www.前加 http:// 即可
所有评论(0)