def dispatch_request(self): try: email = request.form['userEmail'] energy_amount = int(request.form['energyAmount']) rt = RealTimeEnergyData(email=email, energy_amount=energy_amount) rt.push_data() return 'True' except Exception, e: print 'SetDataRecycle : %r'%e return 'False'
def tmp_test_get_set_energy_data(self): rv = self.sign_up('test', 'test') energy_amount=100 test_year, test_month, test_day, test_hour, test_minute, test_second = 2013, 11, 29, 1, 59, 50 time_gap = timedelta(seconds=3) time = datetime(test_year, test_month, test_day, test_hour, test_minute, test_second) for i in xrange(20): print time energy_amount+=3 a = RealTimeEnergyData('test', energy_amount) a.submit_time = time a.push_data() time += time_gap