diff --git a/api/wechat3.py b/api/wechat3.py index f0ceca8..e86a191 100644 --- a/api/wechat3.py +++ b/api/wechat3.py @@ -12,22 +12,17 @@ import time import requests # 此为企业的ID号 -CorpID = '' +CorpID = 'wwa1dc8236066bab50' # 应用的ID -Agentid = 1000004 +Agentid = 1000005 # 认证信息,企业ID+认证信息可获取tokent,获取之后向此tokent发送内容 -Secret = '' +Secret = 'CRzsnYigkQy_9qoHErXG94am81AUuXabY0A8-N7LW_4' localtime = time.strftime("[%H:%M:%S]", time.localtime()) class Tencent(object): - def __init__(self,user,title): - import subprocess - a=subprocess.getoutput("free -h |awk 'NR==2{print $4}'") - b=subprocess.getoutput("df -Th |awk 'NR==2{print $5}'") - c= subprocess.getoutput("uptime |awk -F ':' '{print $NF}'") - msg =a+b+c + def __init__(self,user,title, msg): # 格式化输出内容:标题+内容 self.MSG = f'{title}\n{msg}\n{localtime}' self.User = user @@ -60,6 +55,6 @@ class Tencent(object): if __name__ == '__main__': # 创建对象 - send_obj = Tencent('xxxxx','我就是我,不一样的烟火') + send_obj = Tencent(sys.argv[1],str(sys.argv[2]), str(sys.argv[3])) # 调用发送函数 - send_obj.send_message() \ No newline at end of file + send_obj.send_message()