def get_menu(account): token_rst = get_access_token(account) if token_rst.get("access_token", None): # 获取到了tocken url = WXAPI.MENU_GET_GET + "?access_token=%s" % token_rst["access_token"] return json.loads(HttpClient.exePost(url)) else: return token_rst
def get_access_token(account): url = WXAPI.ACCESS_TOKEN_GET + "?grant_type=%s&appid=%s&secret=%s" % ( account.granttype, account.appid, account.appsecret, ) return json.loads(HttpClient.exeGet(url))
def delete_menu(account): token_rst = get_access_token(account) if token_rst.get("access_token", None): # 获取到了tocken url = WXAPI.MENU_DELETE_GET + "?access_token=%s" % token_rst["access_token"] return json.loads(HttpClient.exeGet(url)) else: # 返回的是错误代码信息 return token_rst
def get_menu(account): token_rst = get_access_token(account) if token_rst.get('access_token', None): #获取到了tocken url = WXAPI.MENU_GET_GET + '?access_token=%s' % token_rst[ 'access_token'] return json.loads(HttpClient.exePost(url)) else: return token_rst
def delete_menu(account): token_rst = get_access_token(account) if token_rst.get('access_token', None): #获取到了tocken url = WXAPI.MENU_DELETE_GET + '?access_token=%s' % token_rst[ 'access_token'] return json.loads(HttpClient.exeGet(url)) else: #返回的是错误代码信息 return token_rst
def create_menu(account, data): token_rst = get_access_token(account) if token_rst.get("access_token", None): # 获取到了tocken url = WXAPI.MENU_CREATE_POST + "?access_token=%s" % token_rst["access_token"] if isinstance(data, unicode): data = data.encode("UTF-8") rst_json = HttpClient.exePost(url, data) return json.loads(rst_json) else: # 返回的是错误代码信息 return token_rst
def create_menu(account, data): token_rst = get_access_token(account) if token_rst.get('access_token', None): #获取到了tocken url = WXAPI.MENU_CREATE_POST + '?access_token=%s' % token_rst[ 'access_token'] if isinstance(data, unicode): data = data.encode('UTF-8') rst_json = HttpClient.exePost(url, data) return json.loads(rst_json) else: #返回的是错误代码信息 return token_rst
def get_access_token(account): url = WXAPI.ACCESS_TOKEN_GET + '?grant_type=%s&appid=%s&secret=%s' % ( account.granttype, account.appid, account.appsecret) return json.loads(HttpClient.exeGet(url))