素材接口#

class wechatpy.client.api.WeChatMaterial(client=None)[源代码]#
add(media_type, media_file, title=None, introduction=None)[源代码]#

新增其它类型永久素材 详情请参考 https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Adding_Permanent_Assets.html

参数
  • media_type – 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)

  • media_file – 要上传的文件,一个 File-object

  • title – 视频素材标题,仅上传视频素材时需要

  • introduction – 视频素材简介,仅上传视频素材时需要

返回

返回的 JSON 数据包

add_reply_comment(msg_data_id, index, user_comment_id, content)[源代码]#

回复评论

batchget(media_type, offset=0, count=20)[源代码]#

获取素材列表 详情请参考 https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Get_materials_list.html

参数
  • media_type – 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(news)

  • offset – 从全部素材的该偏移位置开始返回,0 表示从第一个素材返回

  • count – 返回素材的数量,取值在1到20之间

返回

返回的 JSON 数据包

close_comment(msg_data_id, index=1)[源代码]#

关闭已群发文章评论

delete(media_id)[源代码]#

删除永久素材 详情请参考 https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Deleting_Permanent_Assets.html

参数

media_id – 素材的 media_id

返回

返回的 JSON 数据包

delete_comment(msg_data_id, index, user_comment_id)[源代码]#

删除评论

delete_reply_comment(msg_data_id, index, user_comment_id)[源代码]#

删除回复

get(media_id)[源代码]#

获取永久素材 详情请参考 https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Getting_Permanent_Assets.html

参数

media_id – 素材的 media_id

返回

图文素材返回图文列表,其它类型为素材的内容

get_count()[源代码]#

获取素材总数 详情请参考 https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Get_the_total_of_all_materials.html

返回

返回的 JSON 数据包

list_comment(msg_data_id, index=1, begin=0, count=50, type=0)[源代码]#

查看指定文章的评论数据

markelect_comment(msg_data_id, index, user_comment_id)[源代码]#

将评论标记精选

open_comment(msg_data_id, index=1)[源代码]#

打开已群发文章评论 https://mp.weixin.qq.com/wiki?id=mp1494572718_WzHIY

unmarkelect_comment(msg_data_id, index, user_comment_id)[源代码]#

将评论取消精选