exception_process.py 文件源码

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

项目:structure_spider 作者: ShichaoMa 项目源码 文件源码
def process_requset_method_wrapper(func):

    @wraps(func)
    def wrapper_method(*args, **kwds):
        self = args[0]
        request = kwds.get("request")
        spider = kwds.get("spider")
        try:
            return func(*args, **kwds)
        except Exception as e:
            spider.logger.error("error heppened in process_request method of %s in %s. Error:%s, processing %s," % (
            self.__class__.__name__, IP, traceback.format_exc(), request.url))
            spider.crawler.stats.set_failed_download(request.meta, str(e))
            raise IgnoreRequest(e)

    return wrapper_method
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号