#!/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() #讀取文本文件內(nèi)容
def info():
#url改成你自己機(jī)器人的url 記住你的日志文本里面需要關(guān)鍵字
? ? 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() #關(guān)閉文本文件