热线电话:13121318867

登录
2019-04-08 阅读量: 877
python爬虫出现错误

问题描述:

requests.exceptions.ChunkedEncodingError

解决方法:

对于这个错误,stackoverflow给出的解释是

The link you included in your question is simply a wrapper that executes urllib’s read() function, which catches any incomplete read exceptions for you. If you don’t want to implement this entire patch, you could always just throw in a try/catch loop where you read your links.

问题中给出的链接是执行urllib’s库的read函数时,捕捉到了读取不完整数据导致的异常。如果你不想实现这个完整的不动,只要在读取你的链接时抛出一个try/catch循环即可:

try:
page = urllib2.urlopen(urls).read()
except httplib.IncompleteRead, e:
page = e.partial
16.1763
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子