Exemple #1
0
def stackstrings(request, sample_md5):
    """
    Generate stack strings for a sample. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param sample_md5: The MD5 of the sample to use.
    :type sample_md5: str
    :returns: :class:`django.http.HttpResponse`
    """

    if request.is_ajax():
        strings = make_stackstrings(md5=sample_md5)
        result = {"strings": strings}
        return HttpResponse(json.dumps(result),
                            content_type="application/json")
    else:
        return render(request, 'error.html', {'error': "Expected AJAX."})
Exemple #2
0
def stackstrings(request, sample_md5):
    """
    Generate stack strings for a sample. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param sample_md5: The MD5 of the sample to use.
    :type sample_md5: str
    :returns: :class:`django.http.HttpResponse`
    """

    if request.is_ajax():
        strings = make_stackstrings(md5=sample_md5)
        result = {"strings": strings}
        return HttpResponse(json.dumps(result),
                            content_type="application/json")
    else:
        return render(request, 'error.html', {'error': "Expected AJAX."})