MihoyoBBSTools/push_main-server.py

39 lines
962 B
Python
Raw Normal View History

2021-10-22 14:22:14 +00:00
import sys
import time
import random
import subprocess
from request import http
SendKey = ""
send_Url = f"https://sctapi.ftqq.com/{SendKey}.send"
python_Path = sys.executable
run_ShellCommand = python_Path + " main_multi.py autorun"
for i in range(2):
2021-10-25 14:53:34 +00:00
opt_id, opt_info = subprocess.getstatusoutput(run_ShellCommand)
2021-10-22 14:22:14 +00:00
if opt_id == 0:
break
2021-10-25 14:53:34 +00:00
time.sleep(random.randint(30, 70))
2021-10-22 14:22:14 +00:00
if opt_id != 0:
print("Error!")
http.post(
2021-10-25 14:53:34 +00:00
url=send_Url,
data={
"title": "米游社脚本执行出错!",
2022-01-11 07:54:47 +00:00
"desp": "\nHello!推送相关的设置已修改,请注意更新!\n这里是运行相关日志:\r\n" + opt_info
2021-10-22 14:22:14 +00:00
}
)
else:
http.post(
2021-10-25 14:53:34 +00:00
url=send_Url,
data={
"title": "米游社脚本执行成功",
2022-01-11 07:54:47 +00:00
"desp": "\nHello!推送相关的设置已修改,请注意更新!\n这里是运行相关日志:\r\n" + opt_info
2021-10-22 14:22:14 +00:00
}
)
print("OK!")
exit(0)