其他分享
首页 > 其他分享> > 反爬虫的几种header

反爬虫的几种header

作者:互联网

反爬虫的几种header

headers = {
‘user-agent’:‘Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50’
}

headers = {
‘user-agent’:‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv2.0.1) Gecko/20100101 Firefox/4.0.1’
}

headers = {
‘user-agent’:‘Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11’
}

headers = {
‘user-agent’:‘Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11’

}

headers = {
‘user-agent’:‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11’

}

选择一种后
r = requests.get(‘你要爬取的页面链接’,headers = headers)
print®
返回值为 <Response [200]>则成功

标签:Intel,header,爬虫,agent,几种,headers,Mac,user,Macintosh
来源: https://blog.csdn.net/qy_yyyyy/article/details/119085503