def strings(request, sample_md5): """ Generate 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_data = make_ascii_strings(md5=sample_md5) strings_data += make_unicode_strings(md5=sample_md5) result = {"strings": strings_data} return HttpResponse(json.dumps(result), content_type="application/json") else: return render(request, 'error.html', {'error': "Expected AJAX."})