def get(self): code = 200 msg = '' data = {} parser = reqparse.RequestParser() parser.add_argument('namespace', type=str) parser.add_argument('resource_name', type=str) parser.add_argument('env', type=str) parser.add_argument('pod_name', type=str) args = parser.parse_args() namespace = args.namespace resource_name = args.resource_name pod_name = args.pod_name env = args.env try: Data = {} crp_url = get_CRP_url(env) url = crp_url + "api/openstack/docker/logs/" Data["resource_name"] = resource_name Data["osid"] = pod_name Data["namespace"] = namespace Data["cloud"] = "2" data_str = json.dumps(Data) ret = requests.post(url, data=data_str, headers={'Content-Type': 'application/json'}, timeout=60) res = ret.json() code = res.get("code") if code == 200: logs = res.get("result").get("logs") msg = "Get log success" else: code = 400 logs = "" msg = "Get log failed" data["logs"] = logs except Exception as e: msg = "Get log error {e}".format(e=str(e)) code = 500 data = "Error" Log.logger.error(msg) ret = response_data(code, msg, data) return ret, code
def get(self): try: parser = reqparse.RequestParser() parser.add_argument('reference_sequence', type=str, location='args') parser.add_argument('reference_type', type=str, action='append', location='args') parser.add_argument('item_filter', type=str, action='append', location='args') parser.add_argument('columns_filter', type=str, location='args') parser.add_argument('layer_count', type=str, location='args') parser.add_argument('total_count', type=str, location='args') parser.add_argument('cmdb', type=int) parser.add_argument('view_num', type=str) parser.add_argument('res_id', type=str) # 对应cmdb1.0的资源id,cmdb2.0中的资源实体id parser.add_argument('code', type=str) parser.add_argument('value', type=str) parser.add_argument('department', type=str) args = parser.parse_args() Log.logger.info("get graph from CMDB{}.0".format(args.cmdb)) CMDB_URL = current_app.config['CMDB_URL'] if args.cmdb == 1: if CMDB_URL: result = cmdb_graph_search(args) else: result = {} elif args.cmdb == 2: result = cmdb2_graph_search(args) else: if CMDB_URL: result = cmdb_graph_search(args) else: result = {} #result = response_data(500, "args.cmdb:{}".format(args.cmdb), "") except Exception as exc: Log.logger.error("get graph from cmdb error: {}".format(str(exc))) result = response_data(500, str(exc), "") return jsonify(result)
def put(self): response = response_data(200, "success", "") parser = reqparse.RequestParser() parser.add_argument('model_id', type=str) # 修改的实体id parser.add_argument('instance_id', type=str) # 修改的实例id instance_id == item_id parser.add_argument('property', type=list, location='json') # 改后的属性 parser.add_argument('uid', type=str) parser.add_argument('token', type=str) args = parser.parse_args() try: graph_data = fix_instance(args) response["result"]["data"] = graph_data except Exception as exc: response["code"] = 500 response["result"]["msg"] = str(exc) msg = traceback.format_exc() Log.logger.error(u"修改业务模块工程出错:{}".format(msg)) return jsonify(response)
def delete(self): parser = reqparse.RequestParser() parser.add_argument('perm_id', type=str) args = parser.parse_args() try: Permission = PermissionList.objects.get(perm_id=args.perm_id) Permissions = PermissionList.objects.filter(name=Permission.name) for perm in Permissions: perm.delete() code = 200 msg = "Delete permission success" data = "Success" except Exception as e: msg = "Delete permission error,error msg is %s" % str(e) code = 500 data = "Error" Log.logger.error(msg) ret = response_data(code, msg, data) return ret, code
def put(self): parser = reqparse.RequestParser() parser.add_argument('role', type=str) parser.add_argument('id', type=str) parser.add_argument('department', type=str) args = parser.parse_args() try: user = UserInfo.objects.get(id=args.id) user.role = args.role user.department = args.department user.updated_time = datetime.datetime.now() user.save() code = 200 data = "Success" msg = "Update user info success" except Exception as e: msg = "Update user info error,error msg is %s" % str(e) Log.logger.error(msg) code = 500 data = "Error" ret = response_data(code, msg, data) return ret, code
def post(self): code = 200 parser = reqparse.RequestParser() parser.add_argument('resource_name', type=str) parser.add_argument('project_name', type=str) parser.add_argument('module_name', type=str) parser.add_argument('business_name', type=str) parser.add_argument('cmdb2_project_id', type=str) parser.add_argument('cmdb2_module_id', type=str) parser.add_argument('department', type=str) parser.add_argument('user_name', type=str) parser.add_argument('user_id', type=str) parser.add_argument('env', type=str) parser.add_argument('formStatus', type=str) parser.add_argument('approval_status', type=str) parser.add_argument('resource_list', type=list, location='json') parser.add_argument('compute_list', type=list, location='json') parser.add_argument('cloud', type=str) parser.add_argument('resource_type', type=str) parser.add_argument('domain', type=str) parser.add_argument('lb_methods', type=str) parser.add_argument('namespace', type=str) parser.add_argument('host_mapping', type=list, location='json') parser.add_argument('network_id', type=str, default="") parser.add_argument('scheduler_zone', type=str, default="") parser.add_argument('agree', type=bool, default=True) parser.add_argument('annotations', type=str, default="") parser.add_argument('action', type=str, location='json', default="admin_approve_allow") parser.add_argument('deploy_name', type=str, required=True, location='json') parser.add_argument('initiator', type=str, location='json', default="") parser.add_argument('release_notes', type=str, location='json', default="") parser.add_argument('mysql_exe_mode', type=str, location='json', default="") parser.add_argument('mysql_context', type=str, location='json', default="") parser.add_argument('redis_exe_mode', type=str, location='json', default="") parser.add_argument('redis_context', type=str, location='json', default="") parser.add_argument('mongodb_exe_mode', type=str, location='json', default="") parser.add_argument('mongodb_context', type=str, location='json', default="") parser.add_argument('approve_suggestion', type=str, location='json', default="") parser.add_argument('apply_status', type=str, location='json', default="success") parser.add_argument('approve_status', type=str, location='json', default="success") parser.add_argument('disconf', type=list, location='json', default=[]) parser.add_argument('database_password', type=str, location='json', default="") parser.add_argument('domain_ip', type=str, location='json', default="") parser.add_argument('certificate', type=str, location='json', default="") parser.add_argument('named_url', type=str, location='json', default="") args = parser.parse_args() crp_url = get_CRP_url(args.env) setattr(args, 'crp_url', crp_url) project_name = args.project_name env = args.env # tag = time.time().__str__()[2:10] # resource_name = "{project_name}-{env}-{tag}".format(project_name=project_name,env=env,tag=tag) # setattr(args, 'resource_name', resource_name) i_code, i_msg, cmdb2_project_id, module_id, business_id, project_name, module_name, business_name = get_item_id( project_name) if i_code == 200: setattr(args, 'cmdb2_project_id', cmdb2_project_id) setattr(args, 'module_id', module_id) setattr(args, 'business_id', business_id) setattr(args, 'module_name', module_name) setattr(args, 'business_name', business_name) res_deploy(args) data = "success" msg = "success" setattr(args, 'crp_url', crp_url) else: data = "failed" code = i_code msg = i_msg ret = response_data(code, msg, data) return ret, code
def post(self): parser = reqparse.RequestParser() parser.add_argument('id', type=str) parser.add_argument('password', type=str) args = parser.parse_args() id = args.id password = args.password md5 = hashlib.md5() md5.update(password) salt_password = md5.hexdigest() menu_list = [] try: #用户表里有用户 user = UserInfo.objects.get(id=id) if user.password == salt_password: add_person(user.username, user.id, user.department, "", "") user.last_login_time = datetime.datetime.now() user.save() role = user.role menu_list, buttons, icons, operations = get_login_permission( role) code = 200 msg = u'登录成功' res = { 'user_id': user.id, 'username': user.username, 'department': user.department, 'role': user.role, 'menu_list': menu_list, 'buttons': buttons, 'icons': icons, 'operations': operations, } else: msg = u'登录失败' code = 400 res = u'验证错误' except UserInfo.DoesNotExist as e: #用户表没有用户,验证ldap 创建用户 conn = LdapConn(ldap_server, username, passwd_admin, base_dn, scope) verify_code, verify_res = conn.verify_user(id, password) verify_res_name = verify_res.get('name') # 获取到用户名 verify_res_department = verify_res.get('department') # 获取到部门 user = verify_res_name.decode('utf-8') department = verify_res_department.decode('utf-8') user_id = verify_res.get('id') # 获取到工号 role = "user" if verify_code: msg = u'登录成功' code = 200 try: #不通过ldap手动创建的用户 user = UserInfo.objects.get(id=user_id) user.save() role = user.role except UserInfo.DoesNotExist: user_obj = UserInfo() user_obj.id = user_id user_obj.username = user user_obj.password = salt_password user_obj.department = department user_obj.created_time = datetime.datetime.now() user_obj.updated_time = datetime.datetime.now() user_obj.last_login_time = datetime.datetime.now() user_obj.role = role user_obj.save() add_person(user, user_id, department, "", "") menu_list, buttons, icons, operations = get_login_permission( role) res = { 'user_id': user_id, 'username': user, 'department': department, 'role': role, 'menu_list': menu_list, 'buttons': buttons, 'icons': icons, 'operations': operations, } else: registor_manual(id, user, department) msg = u'登录成功' code = 200 res = u'ldap验证错误,已注册独立uop账号' ret = response_data(code, msg, res) return ret, code
def post(self): parser = reqparse.RequestParser() parser.add_argument('menu_id', type=str, location="json") parser.add_argument('name', type=str, location="json") parser.add_argument('button', type=str, location="json") parser.add_argument('icon', type=str, location="json") parser.add_argument('operation', type=str, location="json") parser.add_argument('url', type=str, location="json") parser.add_argument('perm_type', type=str, location="json") parser.add_argument('endpoint', type=str, location="json") parser.add_argument('level', type=str, location="json") parser.add_argument('parent_id', type=str, location="json") parser.add_argument('api_get', type=str, location="json") parser.add_argument('api_put', type=str, location="json") parser.add_argument('api_post', type=str, location="json") parser.add_argument('api_delete', type=str, location="json") parser.add_argument('isDropdown', type=bool, location="json") parser.add_argument('menu_index', type=int, location="json") parser.add_argument('menu_module', type=str, location="json") args = parser.parse_args() try: code = 200 Permissions = PermissionList.objects.filter( name=args.name, role='super_admin').order_by('created_time') #如果同一角色,有重名的,给前端返回失败信息 if Permissions: msg = "Create permission Failed,The name has already existed" data = "Failed" ret = response_data(code, msg, data) return ret, code perm_id = str(uuid.uuid1()) Permission = PermissionList(perm_id=perm_id, name=args.name, menu_id=args.menu_id, role="super_admin", perm_type=args.perm_type, button=args.button, icon=args.icon, operation=args.operation, url=args.url, endpoint=args.endpoint, level=args.level, parent_id=args.parent_id, api_get=args.api_get, api_post=args.api_post, api_put=args.api_put, api_delete=args.api_delete, isDropdown=args.isDropdown, menu_index=args.menu_index, menu_module=args.menu_module, created_time=datetime.datetime.now(), updated_time=datetime.datetime.now()) Permission.save() msg = "Create permission success" data = "Success" except Exception as e: code = 500 msg = "Create permission error,error msg is %s" % str(e) data = "Error" Log.logger.error(msg) ret = response_data(code, msg, data) return ret, code
def put(self): parser = reqparse.RequestParser() parser.add_argument('permission_list', type=list, location="json") parser.add_argument('role', type=str, location="json") parser.add_argument('perm_type', type=str, location="json") args = parser.parse_args() try: code = 200 same1_perm_list = [] same2_perm_list = [] create_perm_list = [] delete_perm_list = [] have_permissions = PermissionList.objects.filter( role=args.role, perm_type=args.perm_type) #获取相同的权限 for perm in args.permission_list: for have_perm in have_permissions: if perm["name"] == have_perm.name: same1_perm_list.append(perm) same2_perm_list.append(have_perm) #要创建的的权限 for perm in args.permission_list: if perm not in same1_perm_list: create_perm_list.append(perm) #要删除的权限 for have_perm in have_permissions: if have_perm not in same2_perm_list: delete_perm_list.append(have_perm) # 创建没有的权限 for perm in create_perm_list: perm_id = str(uuid.uuid1()) Permission = PermissionList( perm_id=perm_id, name=perm.get("name"), menu_id=perm.get("menu_id"), role=args.role, perm_type=perm.get("perm_type"), button=perm.get("button"), icon=perm.get("icon"), operation=perm.get("operation"), url=perm.get("url"), endpoint=perm.get("endpoint"), level=perm.get("level"), parent_id=perm.get("parent_id"), api_get=perm.get("api_get", '0'), api_post=perm.get("api_post", '0'), api_put=perm.get("api_put", '0'), api_delete=perm.get("api_delete", '0'), isDropdown=perm.get("isDropdown"), menu_index=perm.get("menu_index"), menu_module=perm.get("menu_module"), created_time=datetime.datetime.now(), updated_time=datetime.datetime.now()) Permission.save() #已有的权限更新 for perm in same1_perm_list: Permissions = PermissionList.objects.filter( perm_id=perm.get("perm_id")) if Permissions: Permission = Permissions[0] if perm.get("menu_id"): Permission.menu_id = perm.get("menu_id") if perm.get("name"): Permission.name = perm.get("name") if perm.get("button"): Permission.button = perm.get("button") if perm.get("icon"): Permission.icon = perm.get("icon") if perm.get("operation"): Permission.operation = perm.get("operation") if perm.get("url"): Permission.url = perm.get("url") if perm.get("perm_type"): Permission.perm_type = perm.get("perm_type") if perm.get("endpoint"): Permission.endpoint = perm.get("endpoint") if perm.get("level"): Permission.level = perm.get("level") if perm.get("parent_id"): Permission.parent_id = perm.get("parent_id") if str(perm.get("api_get")): Permission.api_get = perm.get("api_get", '0') if str(perm.get("api_post")): Permission.api_post = perm.get("api_post", '0') if str(perm.get("api_put")): Permission.api_put = perm.get("api_put", '0') if str(perm.get("api_delete")): Permission.api_delete = perm.get("api_delete", '0') if str(perm.get("isDropdown")): Permission.isDropdown = perm.get("isDropdown") if perm.get("menu_index"): Permission.menu_index = perm.get("menu_index") if perm.get("menu_module"): Permission.menu_module = perm.get("menu_module") Permission.updated_time = datetime.datetime.now() Permission.save() #删除多余权限 for perm in delete_perm_list: Permission = PermissionList.objects.get(perm_id=perm.perm_id) Permission.delete() msg = "Update role permission success" data = "Success" except Exception as e: code = 500 msg = "Update role permission error,error msg is %s" % str(e) data = "Error" Log.logger.error(msg) ret = response_data(code, msg, data) return ret, code
def get(self): parser = reqparse.RequestParser() parser.add_argument('role', type=str, location='args') parser.add_argument('perm_type', type=str, location='args') args = parser.parse_args() data = {} res_list = [] role_perm_list = [] try: role_permissions = PermissionList.objects.filter( role=args.role, perm_type=args.perm_type).order_by('created_time') all_permissions = PermissionList.objects.filter( role="super_admin", perm_type=args.perm_type).order_by('created_time') same_perm_list = [] add_perm_list = [] #相同的权限 for all_perm in all_permissions: for role_perm in role_permissions: if role_perm.name == all_perm.name: same_perm_list.append(all_perm) #获取要增加的权限 for all_perm in all_permissions: if all_perm not in same_perm_list: add_perm_list.append(all_perm) for permission in add_perm_list: res = {} res["perm_id"] = permission.perm_id res["menu_id"] = permission.menu_id res["name"] = permission.name res["role"] = permission.role res["button"] = permission.button res["icon"] = permission.icon res["operation"] = permission.operation res["url"] = permission.url res["perm_type"] = permission.perm_type res["created_time"] = str(permission.created_time) res["updated_time"] = str(permission.updated_time) res["endpoint"] = permission.endpoint res["level"] = permission.level res["parent_id"] = permission.parent_id res["api_get"] = "0" res["api_post"] = "0" res["api_put"] = "0" res["api_delete"] = "0" res["isDropdown"] = permission.isDropdown res["menu_index"] = permission.menu_index res["menu_module"] = permission.menu_module res_list.append(res) for permission in role_permissions: res = {} res["perm_id"] = permission.perm_id res["menu_id"] = permission.menu_id res["name"] = permission.name res["role"] = permission.role res["button"] = permission.button res["icon"] = permission.icon res["operation"] = permission.operation res["url"] = permission.url res["perm_type"] = permission.perm_type res["created_time"] = str(permission.created_time) res["updated_time"] = str(permission.updated_time) res["endpoint"] = permission.endpoint res["level"] = permission.level res["parent_id"] = permission.parent_id res["api_get"] = permission.api_get res["api_post"] = permission.api_post res["api_put"] = permission.api_put res["api_delete"] = permission.api_delete res["isDropdown"] = permission.isDropdown res["menu_index"] = permission.menu_index res["menu_module"] = permission.menu_module role_perm_list.append(res) res_list = res_list + role_perm_list data["res_list"] = res_list data["role_perm_list"] = role_perm_list code = 200 msg = "Get role permission info success" except Exception as e: msg = "Get role permission info error,error msg is %s" % str(e) code = 500 data = "Error" Log.logger.error(msg) ret = response_data(code, msg, data) return ret, code
def subgrath_data(args): ''' 插入子图数据,并返回图结果 :param args: :return: ''' history = { "8a3022563add40dbb0130b38": "DevDefaultBusiness", "a03ff39ce13140e499f2344d": "SitDefaultBusiness" } next_model_id, last_model_id, property, uid, token, last_instance_id = \ args.next_model_id, args.last_model_id, args.property, args.uid, args.token, args.last_instance_id if last_instance_id in history.keys(): return response_data(200, "success", u"此业务用于存储历史数据,不能新建模块") ##### get_pro = lambda k, pro: [p["value"] for p in pro if p["code"] == k][0] # Log.logger.info("The get_pro value is {}".format(get_pro)) newid = str(uuid.uuid1()) try: if next_model_id in code_id.keys(): name = get_pro("baseInfo", property) flag = ItemInformation.objects.filter( item_name=name, item_relation=last_instance_id) if flag: return response_data( 500, u"名为{}的已存在{}".format(name, code_id[next_model_id]), "fail") if len(property) == 4: ii = ItemInformation(item_id=newid, item_code=code_id[next_model_id], item_depart=get_pro( "department", property), user=get_pro("user", property), item_relation=last_instance_id, user_id=get_pro("user_id", property), item_name=get_pro("baseInfo", property), cmdb2_project_id=newid) else: ii = ItemInformation( item_id=newid, item_code=code_id[next_model_id], item_depart=get_pro("department", property), user=get_pro("user", property), item_relation=last_instance_id, user_id=get_pro("user_id", property), item_name=get_pro("baseInfo", property), cmdb2_project_id=newid, project_status=get_pro("status", property), Chinese_name=get_pro("Chinese_name", property), version=get_pro("version", property), OPS=get_pro("OPS", property), DEV=get_pro("DEV", property)) # Log.logger.info("The code_id value is {}".format(code_id)) ii.save() # Log.logger.info("Save stop.") else: Log.logger.error(u"检查配置文件的实体信息,业务模块工程的实体id有变化") except Exception as exc: Log.logger.error("Save ItemInformation error:{}".format(str(exc))) return response_data(200, "success", str(exc)) ##### Log.logger.info("Start save to cmdb2 {}".format(args)) exchange_project_item_id = newid to_Cmdb2(args, exchange_project_item_id ) # 将CMDB2.0产生的id,返存到Iteminformation保存,后期不用CMDB2可以省去 return response_data(200, "success", [])
def Aquery(args): ''' A 类视图 查询 :param data: :return: ''' history = { "8a3022563add40dbb0130b38": "DevDefaultBusiness", "a03ff39ce13140e499f2344d": "SitDefaultBusiness" } name, code, uid, token, instance_id, model_id, self_model_id = \ args.name, args.code, args.uid, args.token, args.instance_id, args.model_id, args.self_model_id if APP_ENV in ["development", "testing"]: # 走uop ''' instance_id 对应Iteminformation的item_id, 如果不传默认查询所有业务 ''' Log.logger.info("APP ENV IS {}".format(APP_ENV)) get_model_id = lambda codes, v: [ c[0] for c in codes.items() if c[1] == v ][0] if instance_id == "uop" or not instance_id: if self_model_id == filters.get( "Person") or model_id == filters.get( "department"): # 兼容CMDB2.0查部门的接口,返回部门的id,这里返回uop return response_data( 200, "success", { "instance": [{ "instance_id": "uop", "name": "", "property": [] }] }) business = ItemInformation.objects.filter( item_code="business").order_by("-create_date") instances = [] if business: for b in business: # Log.logger.info("###### in ItemInformation.get") rname = b.item_name tmp = dict(instance_id=b.item_id, cmdb2_project_id=b.cmdb2_project_id, model_id=get_model_id(code_id, "business"), name=rname, property=[{ "code": "baseInfo", "name": u"名称", "value": rname }]) instances.append(tmp) return response_data(200, "success", {"instance": instances}) else: return response_data(200, "success", {"instance": []}) else: # 从uop里查数据 next_instances = ItemInformation.objects.filter(item_relation=instance_id, item_code=code_id[model_id]).\ order_by("-create_date") instances = [] Log.logger.info("NEXT INSTANCE IS {}".format(next_instances)) if next_instances: for ni in next_instances: # Log.logger.info("###### in ItemInformation.get") rname = ni.item_name try: project_status = ni.project_status Chinese_name = ni.Chinese_name version = ni.version OPS = ni.OPS DEV = ni.DEV tmp = dict(instance_id=ni.item_id, model_id=model_id, name=rname, cmdb2_project_id=ni.cmdb2_project_id if ni.cmdb2_project_id else ni.item_id, property=[{ "code": "baseInfo", "name": u"名称", "value": rname }, { "code": "status", "name": u"工程状态", "value": project_status }, { "code": "Chinese_name", "name": u"中文名", "value": Chinese_name }, { "code": "version", "name": u"版本号", "value": version }, { "code": "OPS", "name": u"运维负责人", "value": OPS }, { "code": "DEV", "name": u"业务负责人", "value": DEV }]) except Exception as e: msg = traceback.format_exc() Log.logger.info("========={}".format(msg)) instances.append(tmp) return response_data(200, "success", {"instance": instances}) else: return response_data(200, "success", {"instance": []}) else: # 其他环境暂时走CMDB2 url_list = CMDB2_URL + "cmdb/openapi/instance/list/" url_instance = CMDB2_URL + "cmdb/openapi/query/instance/" # 如果传instance_id,调用这个直接拿到下一层数据 if not uid or not token: uid, token = get_uid_token() if instance_id in history.keys(): res = Statusvm.objects.filter(business_name=history[instance_id]) if res: instances = [] name = set() for r in res: # Log.logger.info("###### in res") rname = r.module_name if rname not in name: tmp = dict(instance_id=str(len(instances)) + "@@", model_id=1, name=rname, property=[{ "code": "baseInfo", "name": u"名称", "value": rname }]) instances.append(tmp) name.add(rname) return response_data(200, "success", {"instance": instances}) else: # Log.logger.info("$$$$$$ not in res") return response_data(200, "success", {"instance": []}) if "@@" in instance_id: res = Statusvm.objects.filter( module_name=instance_id.split("@@")[1]) if res: instances = [] name = set() for r in res: Log.logger.info("###### in res") rname = r.project_name if rname not in name: tmp = dict(instance_id=str(len(instances)) + "@@", model_id=1, name=rname, property=[{ "code": "baseInfo", "name": u"名称", "value": rname }]) instances.append(tmp) name.add(rname) return response_data(200, "success", {"instance": instances}) pass data_list = { "uid": uid, "token": token, "sign": "", "data": { "instance": [{ "instance_id": "", "name": name #工号 }], "entity": { "model_id": self_model_id } } } data_instance = { "uid": uid, "token": token, "sign": "", "data": { "instance": { "model_id": self_model_id, "instance_id": instance_id } } } data_list_str = json.dumps(data_list) data_instance_str = json.dumps(data_instance) try: if instance_id: # Log.logger.info("url_instance request data:{}".format(data_instance)) ret = requests.post(url_instance, data=data_instance_str, timeout=5) # Log.logger.info("url_instance return:{}".format(ret.json())) if ret.json()["code"] == -1: return response_data(500, u"请求参数错误,查看instance_id是否和model_id对应", "") else: data = analyze_data(ret.json()["data"], model_id) else: # Log.logger.info("url_list request data:{}".format(data_list)) ret = requests.post(url_list, data=data_list_str, timeout=5) # Log.logger.info("url_list return:{}".format(ret.json())) data = analyze_data(ret.json()["data"], model_id, flag=True) except Exception as exc: Log.logger.error("Aquery error:{}".format(str(exc))) data = str(exc) data.update({"uid": uid, "token": token}) result = response_data(200, "success", data) return result