Example #1
0
def api_delete_scan(request):
    """POST - Delete a Scan"""
    if request.method == 'POST':
        if "hash" in request.POST:
            resp = delete_scan(request, True)
            if "error" in resp:
                response = make_api_response(resp, 500)
            else:
                response = make_api_response(resp, 200)
        else:
            response = make_api_response({"error": "Missing Parameters"}, 422)
    else:
        response = make_api_response({"error": "Method Not Allowed"}, 405)

    return response
def api_delete_scan(request):
    """POST - Delete a Scan"""
    if api_auth(request.META):
        if request.method == 'POST':
            if "hash" in request.POST:
                resp = delete_scan(request, True)
                if "error" in resp:
                    response = make_api_response(resp, 500)
                else:
                    response = make_api_response(resp, 200)
            else:
                response = make_api_response(
                    {"error": "Missing Parameters"}, 422)
        else:
            response = make_api_response({"error": "Method Not Allowed"}, 405)
    else:
        response = make_api_response(
            {"error": "You are unauthorized to make this request."}, 401)
    return response