<commit_before>from django.shortcuts import render
from django.http import HttpResponse

def index(request):
    return HttpResponse("Hello, world. You're at the index.")



# Create your views here.<commit_msg>stores get post messages in a dirq. if body is set it becomes the dirq body<commit_after>from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.http import require_http_methods
from dirq.queue import Queue
import os

@require_http_methods(["GET","POST"])
def index(request):

    qpath = '/tmp/flask/'
    #taken from ssm2
    QSCHEMA = {'body': 'string', 'signer':'string', 'empaid':'string?'}
    #REJECT_SCHEMA = {'body': 'string', 'signer':'string?', 'empaid':'string?', 'error':'string'}
   
    body = request.body
    #print body

    #for header in request.META:
        #print "%s: %s" % (header, request.META[header])

    inqpath = os.path.join(qpath, 'incoming')
    # rejectqpath = os.path.join(qpath, 'reject')
    inq = Queue(inqpath, schema=QSCHEMA)
    # rejectq = Queue(rejectqpath, schema=REJECT_SCHEMA)

    name = inq.add({'body': body,
                    'signer': 'Greg-Test-signer',
                    'empaid': 'Greg-Test-empaid'})

    response = "Message saved to in queue as %sincoming/%s" % (qpath, name)
    return HttpResponse(response)






# Create your views here.
{'fraction_non_alphanumeric': 0.13539367181751288, 'fraction_numerical': 0.0007358351729212656, 'mean_word_length': 3.641638225255973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1295257', 'n_tokens_mistral': 457, 'n_tokens_neox': 431, 'n_words': 120}