python微信自动群发脚本_python 微信批量发送消息脚本

本文介绍了一个使用Python编写的微信自动群发脚本,通过微信企业号接口,能够批量发送消息给指定用户。不过受限于微信接口的限制,免费用户每天只能发送90条消息。脚本适用于自动化监控场景,如Zabbix。代码示例展示了如何初始化、发送消息的流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

通过python 利用微信公众号,批量发送消息

但是,因为免费的,一天一个用户,只能发90条消息。。。

可以用于zabbix啊,。等监控

#!/usr/bin/env python

# -*- coding: utf-8 -*-

import urllib2

import sys

import simplejson as json

reload(sys)

sys.setdefaultencoding( "utf-8" )

class weChat:

def __init__(self, url, Corpid, Secret):

url = '%s/cgi-bin/gettoken?corpid=%s&corpsecret=%s' % (url, Corpid, Secret)

res = self.url_req(url)

self.token = res['access_token']

print self.token

def url_req(self, url, method='get', data={}):

if method == 'get':

req = urllib2.Request(url)

res = json.loads(urllib2.urlopen(req).read())

elif method == 'post':

req = urllib2.Request(url, data)

res =

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值