From 3fae0091b3c9e35ad600952e4236236f941d3ae7 Mon Sep 17 00:00:00 2001 From: cooper Date: Tue, 18 Jun 2024 22:28:06 +0800 Subject: [PATCH] fix process exception --- newsspider/middlewares.py | 1 + 1 file changed, 1 insertion(+) diff --git a/newsspider/middlewares.py b/newsspider/middlewares.py index c354599..105df84 100644 --- a/newsspider/middlewares.py +++ b/newsspider/middlewares.py @@ -44,6 +44,7 @@ class ProxyMiddleware: def process_exception(self, request, exception, spider): # 处理发生异常的请求 self._handle_proxy_failure(request.meta['proxy'], spider) + spider.info(f"Changing proxy to {request.meta['proxy']} due to exception: {exception}") # 重新调度请求 return request