wechatpy.enterprise.client.api.menu 源代码
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from wechatpy.client.api.base import BaseWeChatAPI
[文档]class WeChatMenu(BaseWeChatAPI):
"""
自定义菜单
https://work.weixin.qq.com/api/doc#90000/90135/90230
"""
[文档] def create(self, agent_id, menu_data):
"""
创建菜单
https://work.weixin.qq.com/api/doc#90000/90135/90231
:param agent_id: 应用id
"""
return self._post(
'menu/create',
params={
'agentid': agent_id
},
data=menu_data
)
[文档] def get(self, agent_id):
"""
获取菜单
https://work.weixin.qq.com/api/doc#90000/90135/90232
:param agent_id: 应用id
"""
return self._get(
'menu/get',
params={
'agentid': agent_id
}
)
[文档] def delete(self, agent_id):
"""
删除菜单
https://work.weixin.qq.com/api/doc#90000/90135/90233
:param agent_id: 应用id
"""
return self._get(
'menu/delete',
params={
'agentid': agent_id
}
)
def update(self, agent_id, menu_data):
self.delete(agent_id)
return self.create(agent_id, menu_data)