python 爬虫 <class 'socket.error'>: [Errno 104] Connection reset by peer)

写google 的 URL 爬虫时遇到的错误
高冷的老师说他做的爬虫都在国外!!!! 所以没遇到过这种问题!!!
google了两天~都是歪果仁的尸体

最后解决办法很简单 爬的哪国的网 就用哪国的代理

比如我的google爬虫在www.google.com.hk

用香港的代理最好的!!

tips www.google.co.kr 配合韩国代理更好用

headers = {
    'host': 'www.google.co.kr',
    'method': 'GET',
    'referer': 'https://www.google.com/',
    'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36'
}
posted @ 2015-11-09 15:26  diaoshe  阅读(1499)  评论(0编辑  收藏  举报