[chronojump-server] Added getPersonByRFID method



commit d07ce9b81f83cb1b064ed3047db22a93ede44be1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 26 06:51:48 2017 +0200

    Added getPersonByRFID method

 main.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/main.py b/main.py
index 65ebf87..2b8aa63 100755
--- a/main.py
+++ b/main.py
@@ -96,6 +96,22 @@ def ping():
 
     return Response("", 201)
 
+@app.route("/getPersonByRFID", methods=['POST'])
+@auto.doc()
+def getPersonByRFID():
+    """chronojump client sends RFID data and person is returned (with -1 id if not found)"""
+    content = request.get_json()
+
+    rfid  = content.get('rfid', "")
+
+    (con, cur) = connect_db()
+
+    selectStr = "SELECT * FROM person where rfid = \"" + rfid + "\""
+    print(selectStr)
+    cur.execute(selectStr)
+    person = cur.fetchall()
+
+    return Response(json.dumps(person))
 @app.route("/uploadEncoderData", methods=['POST'])
 @auto.doc()
 def uploadEncoderData():


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]