コード例 #1
0
 def get(self, request):
     res = {}
     target = request.GET.get("t", None)
     res["status"] = 400
     res["msg"] = "Target has existed database.({})".format(target)
     if target:
         target = format_convert(target)
         b = redis_verify(target)
         if b:
             res["status"] = 200
             res["msg"] = "ok"
     return JsonResponse(res)
コード例 #2
0
 def post(self, request):
     data = request.body.decode().splitlines()
     all = 0
     success = 0
     for temp in data:
         if not temp:
             continue
         all += 1
         target = format_convert(temp)
         b = redis_verify(target)
         if b:
             success += 1
     res = {
         "status": 200,
         "msg": "All:{0} Success:{1}".format(all, success)
     }
     return JsonResponse(res)