python飞书发送消息
环境:
Python:3.6.5
pip install requests
pip install json
#!/usr/bin/env python
#coding=utf-8
import json
import requests
# 你复制的webhook地址
url = "https://open.feishu.cn/open-apis/bot/v2/hook/bc584c90-d16c-4182-a582-697456235f1"
payload_message = {
"msg_type": "text",
"content": {
"text": "主机:\n"
"ip:\n"
"用户:\n"
}
}
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=json.dumps(payload_message))
print(response.text)