<commit_before>import json
import bottle
from bson import json_util
from bottle import route, run, request, abort, response
from pymongo import Connection
 
connection = Connection('localhost', 27017)
db = connection.actions

@route('/action', method='POST')
def add_action():
    data = request.body.readline()
    if not data:
        abort(400, 'You gave me nothing. You fail.')
    entity = json.loads(data)
    print entity
    if not entity.has_key('actionName'):
        abort(400, 'I need an action')
    if not entity.has_key('time'):
        abort(400, 'I need a time')
    try:
        db['action'].save(entity)
    except ValidationError as valerr:
        abort(400, str(valerr))

run(host='localhost', port=8080)
<commit_msg>dont need that<commit_after>import json
import bottle
from bottle import route, run, request, abort, response
from pymongo import Connection
 
connection = Connection('localhost', 27017)
db = connection.actions

@route('/action', method='POST')
def add_action():
    data = request.body.readline()
    if not data:
        abort(400, 'You gave me nothing. You fail.')
    entity = json.loads(data)
    print entity
    if not entity.has_key('actionName'):
        abort(400, 'I need an action')
    if not entity.has_key('time'):
        abort(400, 'I need a time')
    try:
        db['action'].save(entity)
    except ValidationError as valerr:
        abort(400, str(valerr))

run(host='localhost', port=8080)

{'fraction_non_alphanumeric': 0.12121212121212122, 'fraction_numerical': 0.028925619834710745, 'mean_word_length': 3.526479750778816, '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': '147443', 'n_tokens_mistral': 466, 'n_tokens_neox': 441, 'n_words': 140}