想接收企业微信的消息,首先得开启验证信息API(GET请求)以及接收消息服务(POST请求)。
GET的请求参考:
企业微信验证接口API
第一部分解析POST请求:
并且解析msg_signature, time, nonce和消息体数据Body(如下代码中POST的部分)
@app.route(/blackcat/v1/receive_task, methods=[POST, GET])def receive():try:auth_verify = AuthVerify()if request.method == "POST":msg_signature = request.args.get(msg_signature)timestamp = request.args.get( imestamp)nonce = request.args.get(
once)request_data = request.dataparam = auth_verify.verifi_content(msg_signature, timestamp, nonce, request_data)submit_task_receive.delay(param)if request.method == "GET":
如果觉得《Python实现接收企业微信接收消息》对你有帮助,请点赞、收藏,并留下你的观点哦!