class OneRun(views.APIView):
authentication_classes = [JWTAuthentication]
permission_classes = [IsAuthenticated]
def post(self,request):
try:
data = json.loads(request.body)#{'msg': '获取出错啦','data': '获取出错啦'}
dirname=str(data.get('msg'))
parm =str(data.get('data'))
module_api = importlib.import_module("apirun.caserobot." + dirname)
run = module_api.run(parm)
# resp_run = eval(run)
return Response(run)
except:
return JsonResponse({'msg':'请检查脚本文件哦','data' : run})