爬虫报错'Remote end closed connection without response'

爬虫遇到问题 '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 connection without response')