def GET(self, element): if element == 'rpm': return json.dumps({'timestamp': time.time(), 'rpm': current_data.rpm_dat}) elif element == 'bar': return json.dumps({'timestamp': time.time(), 'bar': current_data.bar_dat}) elif element == 'trm': return json.dumps({'timestamp': time.time(), 'trm': current_data.trm_dat}) elif element == 'all': all_ = current_data.get_all() all_.update(timestamp=time.time()) return json.dumps(all_) else: return json.dumps({'error': 'unknown request'})
def GET(self): return render.index(current_data.get_all(), time.time())