Esempio n. 1
0
def show_analysis():
    db = get_db()
    cur = db.execute('select id, reading_time, reading_brew_temp, reading_amb_temp from readings order by id asc')
    readings = cur.fetchall()
    readings_array_list = []
    for reading in readings:
        r = ( reading[0], str(reading[1]), str(reading[2]), str(reading[3]) )
        print(str(r))
        readings_array_list.append(r)
    return render_template('analysis.html', readings=json.loads(build_json()) )
Esempio n. 2
0
 def do_GET(self):
     print (" SELF DATA path "+ str(self.path) )
     form = {}
     if self.path.find('?') > -1:
         queryStr = self.path.split('?')[1]
         form = dict([queryParam.split('=') for queryParam in queryStr.split('&')])
         
     if self.path == "/datareadings.json":
         print ("Data readings request")
         self.send_response(200, 'OK')
         #self.send_header('Content-type', 'text/html')
         self.send_header('Content-type', 'text/json')
         self.end_headers()
         self.wfile.write(str( build_json() ) )
         self.wfile.flush()
         #images = glob.glob('*.jpg')
         #rand = random.randint(0,len(images)-1)
         #imagestring = "<img src = \"" + images[rand] + "\" height = 1028 width = 786 align = \"right\"/> </body> </html>"
         #self.wfile.write(bytes(imagestring, 'UTF-8')
     else:
         print ("normal GET request")
         SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)