def post_data(self, format, station, data_group, t_from, t_to, data): """Filtered/Customized reading of specified time period""" format = clean.format(format) station = clean.station(station) t_from, t_to = clean.time(t_from, t_to) data_group = clean.data_group(data_group) path = f"/data/{format}/{station}/{data_group}/from/{t_from}/to/{t_to}" return self.request_json("POST", path, data)
def post_data_last(self, format, station, data_group, time_period, data): """Filtered/Customized reading of last data""" format = clean.format(format) station = clean.station(station) data_group = clean.data_group(data_group) time_period = clean.time_period(time_period) path = f"/data/{format}/{station}/{data_group}/last/{time_period}" return self.request_json("POST", path, data)
def get_data_last(self, format, station, data_group, time_period): """Reading last data""" format = clean.format(format) station = clean.station(station) data_group = clean.data_group(data_group) time_period = clean.time_period(time_period) path = f"/data/{format}/{station}/{data_group}/last/{time_period}" return self.request_json("GET", path)
def get_data(self, format, station, data_group, t_from, t_to): """Reading data of specific time period""" format = clean.format(format) station = clean.station(station) t_from, t_to = clean.time(t_from, t_to) data_group = clean.data_group(data_group) path = f"/data/{format}/{station}/{data_group}/from/{t_from}/to/{t_to}" return self.request_json("GET", path)
def test_clean_format(self): self.assertEqual(clean.format("normal"), "normal") self.assertEqual(clean.format("optimized"), "optimized") with self.assertRaises(AssertionError): clean.format("other")