#NEWLINE# @ itty . get ( '/energyData' ) #NEWLINE# def energy_data( ) : #NEWLINE# #INDENT# '\n        Connects to the database and loads Readings for device 8.\n    ' #NEWLINE# cur = db . cursor ( ) . execute ( 'SELECT timestamp, current FROM Readings' ) #NEWLINE# original = TimeSeries ( ) #NEWLINE# original . initialize_from_sql_cursor ( cur ) #NEWLINE# original . normalize ( 'day' , fusionMethod = 'sum' ) #NEWLINE# return itty . Response ( json . dumps ( cur , cls = PycastEncoder ) , content_type = 'application/json' )