python企业微信小程序发送信息
在使用下面代码之前先配置webhook
教程如下:文章来源:https://www.toymoban.com/news/detail-737037.html
https://www.bilibili.com/video/BV1oH4y1S7pN/?vd_source=bee29ac3f59b719e046019f637738769
然后使用如下代码就可以发消息了:
代码如下:文章来源地址https://www.toymoban.com/news/detail-737037.html
#coding=gbk
import requests
def send(message:str):
url = "机器人webhook地址"
headers = {
"Content-Type": "application/json"
}
data = {
"msgtype": "text",
"text": {
"content": message,
"mentioned_list": ["@all"]
}
}
response = requests.post(url, headers=headers, json=data)
records = response.json()
return records
def sendAll(message:str):
url = "机器人webhook地址"
headers = {
"Content-Type": "application/json"
}
data = {
"msgtype": "text",
"text": {
"content": message,
"mentioned_list": ["@all"]
}
}
response = requests.post(url, headers=headers, json=data)
records = response.json()
return records
def test(stz):
send(stz)
stz="测试程序"
test(stz)
到了这里,关于python企业微信小程序发送信息的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!