1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- # -*- 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)
|