美文网首页
爬虫报错'Remote end closed connectio

爬虫报错'Remote end closed connectio

作者: WangLane | 来源:发表于2019-04-01 01:15 被阅读0次

爬虫遇到问题 'Remote end closed connection without response'

requests.get反复请求, 应该是tcp连接次数过多.
利用requests模块提供的session来解决就好了

cookies = {
    'this': 'is',  
    'your': 'cookie',
}
headers={
    'your': 'headers',
}
s = requests.session()
s.cookies.update(cookie)
s.headers.update(headers)

url = 'http://httpbin.org'
s.get(url)

相关文章

网友评论

      本文标题:爬虫报错'Remote end closed connectio

      本文链接:https://www.haomeiwen.com/subject/fqopbqtx.html