tengke 发表于 2022-7-1 14:17:58

python爬网类 !!大佬快看我

importrequests
header={
        'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
        'Accept-Encoding':'gzip, deflate',
        'Accept-Language':'zh-CN,zh;q=0.9',
        'Cache-Control':'max-age=0',
        'Connection':'keep-alive',
        'Host':'i.ipyingshe.com',
        'If-Modified-Since:Mon, 16 May 2022 11:12':'08 GMT',
        'If-None-Match':'"62823188-13bd"',
        'Upgrade-Insecure-Requests':'1',
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'}

re=requests.get(url="http://i.ipyingshe.com/#/user/login?redirect=%2Fdashboard%2Findex",headers=header)
print(re.text)

报错内容是: raise ValueError('Invalid header name %r' % (header,))
找了好几遍没有多余的冒号麻烦大佬看一下这个是什么原因

灰晨 发表于 2022-7-1 14:17:59

'If-Modified-Since:Mon, 16 May 2022 11:12':'08 GMT',
改:
'If-Modified-Since': 'Mon, 16 May 2022 11:12:08 GMT'

tengke 发表于 2022-7-1 15:31:26

那网站没有cookie 怎么爬取登录后的界面信息呢?

tengke 发表于 2022-7-1 15:32:45

就像https://ipyingshe.com/这个网站我应该怎么做爬取呢
页: [1]
查看完整版本: python爬网类 !!大佬快看我