update
This commit is contained in:
parent
4661c90034
commit
87f8e3d3de
15
Core.py
15
Core.py
@ -52,14 +52,14 @@ webhook_url_once, timestamp_once, sign_once = gen_sign()
|
|||||||
def check_avaliable(info, title, webhook_url, timestamp, sign):
|
def check_avaliable(info, title, webhook_url, timestamp, sign):
|
||||||
if info:
|
if info:
|
||||||
if fs_activate == "True":
|
if fs_activate == "True":
|
||||||
logger.info(f"{title} 递送中(飞书):")
|
# logger.info(f"{title} 递送中(飞书):")
|
||||||
result = SendToFeishu(info, title, webhook_url, timestamp, sign)
|
result = SendToFeishu(info, title, webhook_url, timestamp, sign)
|
||||||
logger.info(result)
|
logger.info(result)
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
if fs_activate == "True":
|
if wx_activate == "True":
|
||||||
logger.info(f"{title} 递送中(企业微信):")
|
# logger.info(f"{title} 递送中(企业微信):")
|
||||||
result = SendToWX(info, title)
|
result = SendToWX(info, title)
|
||||||
logger.info(result)
|
logger.info(result)
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
@ -70,6 +70,7 @@ def check_avaliable(info, title, webhook_url, timestamp, sign):
|
|||||||
|
|
||||||
def send_job(time_1):
|
def send_job(time_1):
|
||||||
# 爬取数据
|
# 爬取数据
|
||||||
|
logger.info(f"发送程序启动,当前时间为:{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||||
logger.info("正在启动各爬虫并获取资源中...")
|
logger.info("正在启动各爬虫并获取资源中...")
|
||||||
seebug_main()
|
seebug_main()
|
||||||
anquanke_main()
|
anquanke_main()
|
||||||
@ -104,7 +105,7 @@ def send_job(time_1):
|
|||||||
logger.info(send_result)
|
logger.info(send_result)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
if fs_activate == "True":
|
if wx_activate == "True":
|
||||||
send_result = SendToWX("[点此访问](https://info.masonliu.com)网站以查看全部文章。", "单次运行结束")
|
send_result = SendToWX("[点此访问](https://info.masonliu.com)网站以查看全部文章。", "单次运行结束")
|
||||||
logger.info(send_result)
|
logger.info(send_result)
|
||||||
else:
|
else:
|
||||||
@ -122,12 +123,9 @@ signal.signal(signal.SIGTERM, signal_handler) # kill命令
|
|||||||
|
|
||||||
def main_loop(choice):
|
def main_loop(choice):
|
||||||
if choice == 1:
|
if choice == 1:
|
||||||
n = 0
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# 执行任务
|
# 执行任务
|
||||||
n += 1 # 每次循环递增 n
|
|
||||||
logger.info(f"第{n}次执行,当前时间为:{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
||||||
send_job(e_hour)
|
send_job(e_hour)
|
||||||
time.sleep(e_hour * 60 * 60 - 3 * 60)
|
time.sleep(e_hour * 60 * 60 - 3 * 60)
|
||||||
|
|
||||||
@ -136,10 +134,9 @@ def main_loop(choice):
|
|||||||
# result = SendToFeishu(f"发生错误: {e}, 程序已退出", "报错信息")
|
# result = SendToFeishu(f"发生错误: {e}, 程序已退出", "报错信息")
|
||||||
# logger.info(result)
|
# logger.info(result)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
elif choice == 0:
|
elif choice == 0:
|
||||||
n = 0
|
|
||||||
# 设置每天的特定时间点执行job函数
|
# 设置每天的特定时间点执行job函数
|
||||||
logger.info(f"第{n+1}次执行准备开始。")
|
|
||||||
schedule.every().day.at("09:00").do(send_job, 12)
|
schedule.every().day.at("09:00").do(send_job, 12)
|
||||||
schedule.every().day.at("12:00").do(send_job, 3)
|
schedule.every().day.at("12:00").do(send_job, 3)
|
||||||
schedule.every().day.at("15:00").do(send_job, 3)
|
schedule.every().day.at("15:00").do(send_job, 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user