鱼C论坛

 找回密码
 立即注册
查看: 1720|回复: 3

[已解决]python爬网类 !!大佬快看我

[复制链接]
发表于 2022-7-1 14:17:58 | 显示全部楼层 |阅读模式
9鱼币
import  requests
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'

最佳答案

查看完整内容

'If-Modified-Since:Mon, 16 May 2022 11:12':'08 GMT', 改: 'If-Modified-Since': 'Mon, 16 May 2022 11:12:08 GMT'
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 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'
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-7-1 15:31:26 | 显示全部楼层
那网站没有cookie 怎么爬取登录后的界面信息呢?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-7-1 15:32:45 | 显示全部楼层
就像https://ipyingshe.com/这个网站我应该怎么做爬取呢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-27 07:54

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表