Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 def test_clean_format(self):
     self.assertEqual(clean.format("normal"), "normal")
     self.assertEqual(clean.format("optimized"), "optimized")
     with self.assertRaises(AssertionError):
         clean.format("other")