def index(): mqtt_client = Client() mqtt_client.connect('tcp://127.0.0.1:2048') if not request.args: return "未传token" else: token = request.args.get('token').encode() str_token = token.decode('utf-8') action = request.get_json() print(action) sql_data = json.dumps(SearrchORM.select_user(str_token)) print(sql_data) # 鉴权 certify_token(key=sql_data, token=token) # 调用下发指令 print(mqtt_client.dispatch_action('lua/test/data/456', action)) # response return template_jsonify({})