update
This commit is contained in:
parent
24cfa7a998
commit
0ab5c380c2
17
Core.py
17
Core.py
@ -4,6 +4,7 @@
|
|||||||
@Description: 本程序可以爬取各安全资讯源,并发送到飞书群组。
|
@Description: 本程序可以爬取各安全资讯源,并发送到飞书群组。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import signal
|
import signal
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import sys
|
import sys
|
||||||
@ -39,9 +40,23 @@ with open('./config.yaml', 'r', encoding="utf-8") as file:
|
|||||||
e_hour = int(f"{config['e_hour']}")
|
e_hour = int(f"{config['e_hour']}")
|
||||||
|
|
||||||
webhook_url_once, timestamp_once, sign_once = gen_sign()
|
webhook_url_once, timestamp_once, sign_once = gen_sign()
|
||||||
|
|
||||||
|
def rename_log_with_timestamp():
|
||||||
|
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||||
|
original_filename = "./log/spider.log"
|
||||||
|
new_filename = f"./log/spider_{timestamp}.log"
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.rename(original_filename, new_filename)
|
||||||
|
logger.info(f"旧日志文件已成功重命名为: {new_filename}")
|
||||||
|
except FileNotFoundError:
|
||||||
|
logger.error(f"旧日志文件 {original_filename} 未找到。")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"重命名旧日志文件时发生错误: {e}")
|
||||||
|
|
||||||
def send_job(time_1):
|
def send_job(time_1):
|
||||||
# 爬取数据
|
# 爬取数据
|
||||||
print("正在启动各爬虫并获取资源中...")
|
logger.info("正在启动各爬虫并获取资源中...")
|
||||||
seebug_main()
|
seebug_main()
|
||||||
anquanke_main()
|
anquanke_main()
|
||||||
huawei_main()
|
huawei_main()
|
||||||
|
Loading…
Reference in New Issue
Block a user