Jelajahi Sumber

fix(spider): 修复请求时代理配置逻辑错误

- 重新启用请求中的代理配置,确保请求通过代理发送
- 注释掉无代理的请求调用,方便后续调试和切换
- 保持请求超时设置为(5, 30)秒不变
- 优化代码注释,提升代码可读性和维护性
charley 4 minggu lalu
induk
melakukan
72756e66b4
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      zc_spider/zc_new_daily_spider.py

+ 2 - 2
zc_spider/zc_new_daily_spider.py

@@ -93,8 +93,8 @@ def make_encrypted_post_request(log, url: str, request_data: dict, extra_headers
     encrypted_body = CryptoHelper.encrypt_request_data(request_data)
     # print(request_headers)
     # response = requests.post(url, headers=request_headers, json=encrypted_body, timeout=22, proxies=get_proxys(log))
-    # response = requests.post(url, headers=request_headers, json=encrypted_body, timeout=(5, 30), proxies=get_proxys(log))
-    response = requests.post(url, headers=request_headers, json=encrypted_body, timeout=(5, 30))
+    response = requests.post(url, headers=request_headers, json=encrypted_body, timeout=(5, 30), proxies=get_proxys(log))
+    # response = requests.post(url, headers=request_headers, json=encrypted_body, timeout=(5, 30))
     # response.raise_for_status()
 
     if response.status_code == 200: