downloadermiddlewares.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:structure_spider 作者: ShichaoMa 项目源码 文件源码
def process_exception(self, request, exception, spider):

        if isinstance(exception, self.EXCEPTIONS_TO_RETRY) \
                and not request.meta.get('dont_retry', False):
            return self._retry(request, "%s:%s" % (exception.__class__.__name__, exception), spider)

        else:
            if request.meta.get("callback") == "parse":
                spider.crawler.stats.inc_total_pages(crawlid=request.meta['crawlid'])

            self.logger.error("in retry request error %s" % traceback.format_exc())
            raise IgnoreRequest("%s:%s unhandle error. " % (exception.__class__.__name__, exception))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号