• requests.exceptions.MissingSchema: Invalid URL 'xxxxxxxxxxxxx': No schema supplied. Perhaps you meant xxxxxxxxxxxxx


     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:// 即可
  • 相关阅读:
    自己学习并保存的一些shell命令
    【Debian学徒记事】 Debian 安装源配置
    第十三周学习总结
    第十二周学习总结
    第十一周学习总结
    第十周CTF解答
    第十周学习总结
    第九周学习总结
    第八周学习总结
    动态规划:最大子串和
  • 原文地址:https://www.cnblogs.com/xuchunlin/p/6774377.html
Copyright © 2020-2023  润新知