kejiayuan0806

2019-04-08   阅读量: 649

数据分析师 Python爬虫

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
添加CDA认证专家【维克多阿涛】,微信号:【cdashijiazhuang】,提供数据分析指导及CDA考试秘籍。已助千人通过CDA数字化人才认证。欢迎交流,共同成长!
16.1763 1 0 关注作者 收藏

评论(0)


暂无数据

推荐课程

推荐帖子