爬虫运行时报:'Connection broken: IncompleteRead(1482 bytes read, 2614 more expected)', IncompleteRead(1482 bytes read, 2614 more expected)的错误。
解决方法: 在请求时加上stream = True
eg:
response = requests.get(url=url, headers=headers, proxies=proxies, stream=True)
本文介绍了一种常见的爬虫运行时遇到的'Connection broken'错误,即'IncompleteRead'问题,通常表现为读取的数据比预期少。文章提供了解决方案,建议在发送请求时使用stream参数设置为True,以避免此类错误的发生。
爬虫运行时报:'Connection broken: IncompleteRead(1482 bytes read, 2614 more expected)', IncompleteRead(1482 bytes read, 2614 more expected)的错误。
解决方法: 在请求时加上stream = True
eg:
response = requests.get(url=url, headers=headers, proxies=proxies, stream=True)
1万+
7980
2971
2582
1184