コード例 #1
0
ファイル: webserver.py プロジェクト: TYTTVN/snoopy-ng
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']  ))
コード例 #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']))
コード例 #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']))
コード例 #4
0
ファイル: webserver.py プロジェクト: YarThePirate/snoopy-ng
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']))