I have the following Python code that retrieves my saved json data in Google's Firebase.
from flask import Flask, render_template, json
from firebase import firebase
app = Flask(__name__)
@app.route('/')
def homepage():
return render_template("main.html")
@app.route("/getData")
def getData():
firebase = firebase.FirebaseApplication('https://my-firebase-db-958b1.firebaseio.com/', None)
result = firebase.get('/Dublin-Ireland', None)
print result
print "\n"
return result
if __name__ == "__main__":
app.run()
The following is a sample of my json data stored in Firebase.
{"temperature":
{"-KoiWmZOUVfyK28p5Trf":
{"date": "10/07/2017", "time": "23:03:15", "value": 13},
"-KoiWtBFzfBuLG9fvooE":
{"date": "10/07/2017", "time": "23:03:36", "value": 12},
"-KoiWyErPjRXW61LDULf":
{"date": "10/07/2017", "time": "23:04:03", "value": 13},
"-KoiX2Iu0jTK7NJGi86y":
{"date": "10/07/2017", "time": "23:04:24", "value": 13},
"-KoiX7PFmqV9wiujEue5":
{"date": "10/07/2017", "time": "23:04:44", "value": 12},
"-KoiXCe_iFl5VWIyaTp-":
{"date": "10/07/2017", "time": "23:05:05", "value": 20},
"-KoiXEAw06xV58vuYwNe":
{"date": "10/07/2017", "time": "23:05:12", "value": 19},
"-KoiXJDN82RRVAzxQXF8":
{"date": "10/07/2017", "time": "23:05:33", "value": 16},
"-KoiXOHQmax8ywFmdi_i":
{"date": "10/07/2017", "time": "23:05:54", "value": 20},
"-KoiXTKXqETu2QcysDqu":
{"date": "10/07/2017", "time": "23:06:14", "value": 10},
"-KoiYzpYtbmmOD5FKHz_":
{"date": "10/07/2017", "time": "23:12:54", "value": 15},
"-KoiZ9xbcCO75-uVt_wW":
{"date": "10/07/2017", "time": "23:13:39", "value": 11},
"-KoiZF32ZjTGTWFi1amd":
{"date": "10/07/2017", "time": "23:14:00", "value": 10},
"-KoiZJxbSjf5AANRjiU0":
{"date": "10/07/2017", "time": "23:14:20", "value": 13},
"-KoiZYED510Clr8k2YKh":
{"date": "10/07/2017", "time": "23:15:19", "value": 11},
"-KoiZk_q_xuNcrLGLh0z":
{"date": "10/07/2017", "time": "23:16:13", "value": 20},
"-Koi_1zD7AUvd1r4YioA":
{"date": "10/07/2017", "time": "23:17:29", "value": 18},
"-Koi_KKboiigBkXKFW9y":
{"date": "10/07/2017", "time": "23:18:44", "value": 15}
}
}
I have another python code, running in a Raspberry Pi that sends a random temperature data to Firebase every 10 seconds. My ultimate aim is to be able to get that data and plot a graph using the Flask Server that I am running locally at the moment. Shouldn't this code just display the json data as printed in the terminal? What am I doing wrong?