class Wechat(Resource):
def get(self):
TOKEN = "lk2ikklsdoi3uj4nj1"
logger.info("[wechat] check enter [%s]" % (request.args))
signature = request.args.get("signature", "")
timestamp = request.args.get("timestamp", "")
nonce = request.args.get("nonce", "")
echostr = request.args.get("echostr", "")
logger.info("[wechat] check - [%s] - [%s] - [%s]" % (signature, timestamp, nonce))
if not signature or not timestamp or not nonce:
return False
tmp_str = "".join(sorted([TOKEN, timestamp, nonce]))
tmp_str = str(hashlib.sha1(tmp_str.encode('UTF-8')).hexdigest())
logger.info("[wechat] signature - [%s] - [%s]" % (tmp_str, signature))
if tmp_str == signature:
logger.info("[wechat] signature - succeess - [%s]" % (echostr))
return echostr
else:
logger.info("[wechat] signature - fail")
return False
我参数没收到echostr
直接返回echostr 都不行,有人遇到了嘛?