Add getQuestionData route
This commit is contained in:
@@ -22,9 +22,13 @@ def getNodeInfoIndex():
|
||||
macAdress = request.args.get('macAdress', None)
|
||||
return getNodeInfo(macAdress)
|
||||
|
||||
@app.route('/getQuestionData')
|
||||
def getQuestionDataIndex():
|
||||
return getQuestionData()
|
||||
|
||||
def updateData(node, name, location):
|
||||
mydb = loginDB()
|
||||
query = update_query(node, name, location)
|
||||
query = update_query(node, name, location, False, False)
|
||||
cursor = mydb.cursor(dictionary=True) # Enable dictionary output
|
||||
cursor.execute(query)
|
||||
mydb.commit()
|
||||
@@ -45,7 +49,7 @@ def loginDB():
|
||||
|
||||
def getData(node, dataType, MAC):
|
||||
mydb = loginDB()
|
||||
query = get_query(node, dataType, MAC)
|
||||
query = get_query(node, dataType, MAC, False, False)
|
||||
cursor = mydb.cursor(dictionary=True) # Enable dictionary output
|
||||
cursor.execute(query)
|
||||
result = cursor.fetchall() # Fetch the results
|
||||
@@ -56,7 +60,18 @@ def getData(node, dataType, MAC):
|
||||
|
||||
def getNodeInfo(macAdress):
|
||||
mydb = loginDB()
|
||||
query = get_query(False, False, macAdress)
|
||||
query = get_query(False, False, macAdress, False, False)
|
||||
cursor = mydb.cursor(dictionary=True) # Enable dictionary output
|
||||
cursor.execute(query)
|
||||
result = cursor.fetchall() # Fetch the results
|
||||
cursor.close()
|
||||
mydb.close()
|
||||
|
||||
return result
|
||||
|
||||
def getQuestionData():
|
||||
mydb = loginDB()
|
||||
query = get_query(False, False, False, True, False)
|
||||
cursor = mydb.cursor(dictionary=True) # Enable dictionary output
|
||||
cursor.execute(query)
|
||||
result = cursor.fetchall() # Fetch the results
|
||||
|
Reference in New Issue
Block a user