Example #1
0
    def get(self, request, *args, **kwargs):
        """
        获取今日未更新的资产 - 适用SSH或Salt客户端
        :param request:
        :param args:
        :param kwargs:
        :return:
        1.今日未更新
        2.资产状态是在线
        models.tb.objects.filter(f1=1, f2=2)
        models.tb.objects.filter(**{f1:xx,f})
        Q1对象{内部OR:id=1,name='alex'}
        Q2对象{内部OR:id=1,name='alex'}
        Q(Q1,and,Q2)
        """

        # test = {'user': '******', 'pwd': '密码'}
        # result = json.dumps(test,ensure_ascii=True)
        # result = json.dumps(test,ensure_ascii=False)
        # return HttpResponse(result)

        # test = {'user': '******', 'pwd': '密码'}
        # result = json.dumps(test,ensure_ascii=True)
        # result = json.dumps(test,ensure_ascii=False)
        # return HttpResponse(result,content_type='application/json')

        # test = {'user': '******', 'pwd': '密码'}
        # return JsonResponse(test, json_dumps_params={"ensure_ascii": False})

        response = asset.get_untreated_servers()
        return JsonResponse(
            response.__dict__
        )  # JsonResponse在内部实际上就是先进行json.dump将字典转化成字符串,然后通过再返回给用户
Example #2
0
    def get(self, request, *args, **kwargs):
        """
        获取今日未更新的资产 - 适用SSH或Salt客户端
        """

        response = asset.get_untreated_servers()
        return JsonResponse(response.__dict__)
Example #3
0
 def get(self, request, *args, **kwargs):
     """
     更新或者添加资产信息
     :param request:
     :param args:
     :param kwargs:
     :return: 1000 成功;1001 接口授权失败;1002 数据库中资产不存在
     """
     response = asset.get_untreated_servers()
     return JsonResponse(response.__dict__)
Example #4
0
 def get(self,request,*args,**kwargs):
     '''
     获取今日未更新的资产 - 用于SSH或Salt客户端
     :param request:
     :param args:
     :param kwargs:
     :return:
     '''
     response = asset.get_untreated_servers()
     return JsonResponse(response.__dict__)
Example #5
0
 def get(self, request, *args, **kwargs):
     """
     获取今日未更新的资产 - 适用SSH或Salt客户端
     :param request:
     :param args:
     :param kwargs:
     :return:
     """
     # print('11111111111111')
     response = get_untreated_servers()
     print(response.__dict__)
     return JsonResponse(response.__dict__)
Example #6
0
    def get(self, request, *args, **kwargs):
        """
        获取今日未更新的资产 - 适用SSH或Salt客户端
        :param request:
        :param args:
        :param kwargs:
        :return:
        """

        # test = {'user': '******', 'pwd': '密码'}
        # result = json.dumps(test,ensure_ascii=True)
        # result = json.dumps(test,ensure_ascii=False)
        # return HttpResponse(result)

        # test = {'user': '******', 'pwd': '密码'}
        # result = json.dumps(test,ensure_ascii=True)
        # result = json.dumps(test,ensure_ascii=False)
        # return HttpResponse(result,content_type='application/json')

        # test = {'user': '******', 'pwd': '密码'}
        # return JsonResponse(test, json_dumps_params={"ensure_ascii": False})

        response = asset.get_untreated_servers()
        return JsonResponse(response.__dict__)