#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import psutil
import datetime
import time
import socket
import sys
import json
import requests
txt=open('/data/cromtab/jiankong.txt','r') #打开文本文件
msg=txt.read() #读取文本文件内容
def info():
#url改成你自己机器人的url 记住你的日志文本里面需要关键字
url = 'https://oapi.dingtalk.com/robot/send?access_token=9c5ca3284b320e35868fa6a249e4071b573cc453598ffc27738b7a00d22a3f01'
headers = {
'Content-Type': 'application/json;charset=utf-8'
}
formdata = {
"msgtype": "text",
"text": {"content":str(msg)}
}
post = requests.post(url=url, data=json.dumps(formdata), headers=headers)
print (post.text)
if __name__ == '__main__':
info()
txt.close() #关闭文本文件