Exemple #1
0
def catch_data():
    if request.headers['Content-Type'] == 'application/json':
        try:
            jsdata = json_to_objs(request.data)
        except Exception,e:
            logging.error("Unable to parse JSON from '%s'" % request)
            return '{"result":"failure", "reason":"Check server logs"}'
        else:
            server_data.append((jsdata['table'], jsdata['data']  ))
Exemple #2
0
def catch_data():
    if request.headers['Content-Type'] == 'application/json':
        try:
            jsdata = json_to_objs(request.data)
        except Exception, e:
            logging.error("Unable to parse JSON from '%s'" % request)
            return '{"result":"failure", "reason":"Check server logs"}'
        else:
            server_data.append((jsdata['table'], jsdata['data']))
Exemple #3
0
def catch_data():
    if request.headers['Content-Type'] == 'application/json':
        try:
            jsdata = json_to_objs(request.data)
        except Exception, e:
            logging.error("Unable to parse JSON from '%s'" % request)
            return '{"result":"failure", "reason":"Check server logs"}'
        else:
            server_type = os.getenv('SNOOPY_SERVER', 'flask')
            if server_type == 'apache':
                write_local_db([jsdata])
            else:
                server_data.append((jsdata['table'], jsdata['data']))
Exemple #4
0
def catch_data():
    if request.headers['Content-Type'] == 'application/json':
        try:
            jsdata = json_to_objs(request.data)
        except Exception,e:
            logging.error("Unable to parse JSON from '%s'" % request)
            return '{"result":"failure", "reason":"Check server logs"}'
        else:
            server_type = os.getenv('SNOOPY_SERVER', 'flask')
            if server_type == 'apache':
                write_local_db([jsdata])
            else:
                server_data.append((jsdata['table'], jsdata['data']))