def post(): from flask import request import models import json import parser if request.method == 'POST': try: data = json.loads(request.data.decode(encoding='UTF-8')) except Exception as e: return '', 400 if parser.validates_json_object(data): model = models.getInstance(models.FlaskModel) statement = model.table.insert().values(json=request.data) model.execute(statement) return '', 200 return '', 400
def __init__(self, model): import models self.model = models.getInstance(model)