def get(self): signature = request.args.get('signature', '') timestamp = request.args.get('timestamp', '') nonce = request.args.get('nonce', '') # 随机数 if not check_signature(timestamp, nonce, signature): return abort(403) return request.args.get('echostr', '') # 随机字符串
def post(self): signature = request.args.get('signature', '') timestamp = request.args.get('timestamp', '') nonce = request.args.get('nonce', '') # 随机数 if not check_signature(timestamp, nonce, signature): return abort(403) try: input_xml = request.data replay_message = WeChat().replay(input_xml) assert input_xml and replay_message g.logger.info(input_xml) g.logger.info(replay_message) except Exception, e: g.logger.error(str(e)) return ''