dzr il y a 2 jours
Parent
commit
9ee7044fea
2 fichiers modifiés avec 10 ajouts et 14 suppressions
  1. 4 9
      lzz_theme/crontab.txt
  2. 6 5
      lzz_theme/utils/tools.py

+ 4 - 9
lzz_theme/crontab.txt

@@ -1,4 +1,3 @@
-
 PYTHONPATH=/mnt/lzz_theme/utils:/mnt/lzz_theme
 NODE_PATH=/usr/lib/node_modules
 
@@ -10,15 +9,11 @@ NODE_PATH=/usr/lib/node_modules
 # 湖南省政府采购电子卖场
 10 6-23/3 * * * cd /mnt/lzz_theme/hnszfcgdzmc && ./start.sh
 20 6-23/1 * * * cd /mnt/lzz_theme/hnszfcgdzmc && ./dt_start.sh
-
 30 6-23/3 * * * cd /mnt/lzz_theme/hnszfcgdzmc_new && ./start.sh
 
 # 天津市政府采购网
 */10 * * * * cd /mnt/lzz_theme/tjszfcgw && ./start.sh
 
-# 香港医院管理局
-# 0 */3 * * * cd /mnt/lzz_theme/xgyyglj && ./start.sh
-
 # 云南省政府采购网-采购意向公开
 0 */1 * * * cd /mnt/lzz_theme/ynszfcgw && ./det_start.sh
 0 */4 * * * cd /mnt/lzz_theme/ynszfcgw && ./start.sh
@@ -56,6 +51,7 @@ NODE_PATH=/usr/lib/node_modules
 # 15 4,13 * * * cd /mnt/lzz_theme/zgzbtbggfwpt && python3 spider_detail_retry.py > /dev/null &
 
 # 全国招标公告公示搜索引擎
+* * * * * cd /mnt/lzz_theme/qgzbgggsssyq && python3 spider_list_w.py > /dev/null &
 # */2 9-23,0 * * * cd /mnt/lzz_theme/qgzbgggsssyq && python3 spider_list_f.py > /dev/null &
 # */20 * * * * cd /mnt/lzz_theme/qgzbgggsssyq && python3 spider_detail.py > /dev/null &
 # */20 * * * * cd /mnt/lzz_theme/qgzbgggsssyq && python3 spider_list.py > /dev/null &
@@ -79,9 +75,9 @@ NODE_PATH=/usr/lib/node_modules
 
 # 中国大唐集团公司电子商务平台
 20 7-20/1 * * * cd /mnt/lzz_theme/zgdtjtgsdzswpt && ./start.sh
-30 9 * * * cd /mnt/lzz_theme/zgdtjtgsdzswpt && python3 retry_dtpy.py > log/retry_dtpy.out 2>&1
+30 9 * * * cd /mnt/lzz_theme/zgdtjtgsdzswpt && python3 retry_dtpy.py > /dev/null 2>&1
 
-# 中国大唐集团公司电子商务平台 30分钟一轮(中国移动要求改采集频率)
+# 中国大唐集团公司电子商务平台 30分钟一轮(中国移动补采需求整改采集频率)
 30 * * * * cd /mnt/lzz_theme/zgdtjtgsdzswpt_m30 && ./start_m30.sh
 
 # 友云采
@@ -129,5 +125,4 @@ NODE_PATH=/usr/lib/node_modules
 
 # 云筑网 
 20 7-19/2 * * * cd /mnt/lzz_theme/yzw && ./start.sh
-30 6 * * * cd /mnt/lzz_theme/yzw && python3 reset_count.py > log/reset_count.out 2>&1
-
+30 6 * * * cd /mnt/lzz_theme/yzw && python3 reset_count.py > /dev/null 2>&1

+ 6 - 5
lzz_theme/utils/tools.py

@@ -73,13 +73,14 @@ def get_proxy(scheme=None, default=None, socks5h=False):
     headers = {"Authorization": "Basic amlhbnl1MDAxOjEyM3F3ZSFB"}
     while True:
         try:
-            response = requests.get(url, headers=headers).json()
+            response = requests.get(url, headers=headers, timeout=5)
             response.raise_for_status()
-        except requests.exceptions.RequestException as e:
-            logger.error(f"代理获取失败 | {type(e).__name__} | {e}")
-            raise e
+            resp_json = response.json()
+        except Exception as why:
+            logger.error(f"代理获取失败 | {type(why).__name__} | {why}")
+            raise why
 
-        proxies = response.get("data")
+        proxies = resp_json.get("data")
         if proxies:
             break
         else: