def update_remark(openid, remark): api = SimpleApi.make_api( api_url="https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token={token}".format( token=get_access_token() ), post_data={"openid": str(openid), "remark": str(remark)}, ) result = api.get_data() if result.get("errcode", 0) != 0: raise WeixinError(u"err in update_remark %s" % str(result)) return True
def get_next_openid_list(_next_openid): if _next_openid: api_url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token={token}&next_openid={next_openid}".format( token=get_access_token(), next_openid=_next_openid ) else: api_url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token={token}".format(token=get_access_token()) api = SimpleApi.make_api(api_url=api_url) # success result: {"total":2,"count":2,"data":{"openid":["","OPENID1","OPENID2"]},"next_openid":"NEXT_OPENID"} result = api.get_data() if "errorcode" in result: raise WeixinError(u"error when pull subscriber list return %s" % str(result)) _next_openid = result.get("next_openid") # no more data if result.get("count") == 0: return [], None else: op_list = result["data"]["openid"] return op_list, _next_openid