功能亮点
- 一键批量操作
- 文章自动排版
- 支持自定义文章数量
- 适用于多号操作
- 支持文章管理、查询、查看
- 支持查询当前状态
适用对象
- 公众号运营批量文章上传发布
- 矩阵号管理
部分关键代码及步骤
-
微信公众号后台的设置与开发栏目中的基本配置里获取appid和appsecret。
-
获取微信公众号的
appid
和appsecret
access_token是公众号的全局唯一接口调用凭据,公众号调用各接口时都需使用access_token。以下为获取access_token的函数。
def get_access_token(AppSecret, AppID):
url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={}&secret={}'.format(
AppID, AppSecret)
response = requests.get(url)
res_html = response.json()
# print(res_html)
access_token = res_html['access_token']
return access_token
该函数用于获取微信公众号的访问令牌(access token)。通过传入AppSecret和AppID两个参数,构造请求URL并使用requests库发送GET请求。接收到响应后,解析JSON格式的响应内容,提取出access token并返回。
- 新增封面图片永久素材
def push_image(access_token, image_path):
media_type =