MCPcopy Create free account
hub / github.com/doraemonext/wechat-python-sdk / create_menu

Method create_menu

wechat_sdk/basic.py:332–380  ·  view source on GitHub ↗

创建自定义菜单 :: # -*- coding: utf-8 -*- wechat = WechatBasic(appid='appid', appsecret='appsecret') wechat.create_menu({ 'button':[ { 'type': 'click', 'name': '今日歌曲',

(self, menu_data)

Source from the content-addressed store, hash-verified

330 return self.conf.grant_jsapi_ticket()
331
332 def create_menu(self, menu_data):
333 """
334 创建自定义菜单 ::
335
336 # -*- coding: utf-8 -*-
337 wechat = WechatBasic(appid='appid', appsecret='appsecret')
338 wechat.create_menu({
339 'button':[
340 {
341 'type': 'click',
342 'name': '今日歌曲',
343 'key': 'V1001_TODAY_MUSIC'
344 },
345 {
346 'type': 'click',
347 'name': '歌手简介',
348 'key': 'V1001_TODAY_SINGER'
349 },
350 {
351 'name': '菜单',
352 'sub_button': [
353 {
354 'type': 'view',
355 'name': '搜索',
356 'url': 'http://www.soso.com/'
357 },
358 {
359 'type': 'view',
360 'name': '视频',
361 'url': 'http://v.qq.com/'
362 },
363 {
364 'type': 'click',
365 'name': '赞一下我们',
366 'key': 'V1001_GOOD'
367 }
368 ]
369 }
370 ]})
371
372 详情请参考 http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html
373 :param menu_data: Python 字典
374 :return: 返回的 JSON 数据包
375 """
376 menu_data = self._transcoding_dict(menu_data)
377 return self.request.post(
378 url='https://api.weixin.qq.com/cgi-bin/menu/create',
379 data=menu_data
380 )
381
382 def get_menu(self):
383 """

Callers 1

test_create_menuMethod · 0.95

Calls 2

_transcoding_dictMethod · 0.80
postMethod · 0.80

Tested by 1

test_create_menuMethod · 0.76