python企业微信小程序发送信息

python企业微信小程序发送信息

在使用下面代码之前先配置webhook

教程如下:

https://www.bilibili.com/video/BV1oH4y1S7pN/?vd_source=bee29ac3f59b719e046019f637738769

然后使用如下代码就可以发消息了:

代码如下:

python 复制代码
#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)
相关推荐
逝水无殇8 分钟前
C# 反射详解
开发语言·后端·c#
xlxxy_23 分钟前
sap获取批次特性报表
java·linux·开发语言·前端·数据库·abap·mm
北冥you鱼25 分钟前
Go语言常用包使用指南:从标准库到第三方利器
开发语言·microsoft·golang
俺不中嘞33 分钟前
python常用函数
开发语言·python
欢喜躲在眉梢里42 分钟前
用飞算Java做了一套新能源充电运营管理系统:把站点、设备、订单拆成可运营的微服务
java·开发语言·微服务·ai编程·技术分享·java开发·飞算javaai炫技赛
薛定猫AI1 小时前
【技术干货】大模型文档结构化提取实战:Python解析PDF发票并批量生成CSV
java·python·pdf
zhiSiBuYu05171 小时前
RAG 性能优化与缓存策略实战指南
人工智能·python·机器学习
荣码1 小时前
Prompt工程实战:同一个需求换3种写法,效果差10倍
java·python
想会飞的蒲公英1 小时前
集成学习入门:Bagging、Boosting 到底在组合什么
人工智能·python·机器学习·集成学习·boosting
努力努力再努力搬砖1 小时前
批量下载ERA5数据
python