@app.route('/') def index(): signature = request.args.get("signature") timestamp = request.args.get("timestamp") nonce = request.args.get("nonce") echostr = request.args.get("echostr") token = "設置的token" list = [token, timestamp, nonce] list.sort() sha1 = hashlib.sha1() map(sha1.update, list) hashcode = sha1.hexdigest() print "handle/GET func: hashcode, signature: ", hashcode, signature if hashcode == signature: return echostr return "ok"
微信官方文檔:https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Getting_Started_Guide.html
保證填寫的服務器地址(URL) 80端口轉到此路徑下即可
