Add getQuestionData route

This commit is contained in:
sietse jonker
2024-03-29 15:18:36 +01:00
parent 30a739d02b
commit 5bf5a193b9
2 changed files with 23 additions and 5 deletions

View File

@@ -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