def post_chart(self, type, station, data_group, t_from, t_to, data): """Charting customized for period""" station = clean.station(station) t_from, t_to = clean.time(t_from, t_to) data_group = clean.data_group(data_group) path = f"/chart/{type}/{station}/{data_group}/from/{t_from}/to/{t_to}" return self.request_json("POST", path, data)
def get_station_events(self, station, t_from, t_to, sort): """Station events from to""" station = clean.station(station) t_from, t_to = clean.time(t_from, t_to) sort = clean.sort(sort) path = f"/station/{station}/events/from/{t_from}/to/{t_to}/{sort}" return self.request_json("GET", path)
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 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 get_station_history(self, station, filter, t_from, t_to, sort): """Station communication history from to filter""" station = clean.station(station) filter = clean.filter(filter) t_from, t_to = clean.time(t_from, t_to) sort = clean.sort(sort) path = f"/station/{station}/history/{filter}/from/{t_from}/to/{t_to}/{sort}" return self.request_json("GET", path)
def test_clean_time(self): tz = timezone(timedelta(hours=5)) # (5 hours east of utc) a, b, c, d = clean.time( datetime(2018, 10, 1, 0, 0), datetime(2018, 10, 1, 5, 0, tzinfo=tz), 1538352000, "1538352000", ) self.assertEqual(a, "1538352000") self.assertEqual(b, "1538352000") self.assertEqual(c, "1538352000") self.assertEqual(d, "1538352000")
def get_camera_photos(self, station, t_from, t_to, camera): """Retrieve pictures for specified period""" station = clean.station(station) t_from, t_to = clean.time(t_from, t_to) path = f"/camera/{station}/photos/from/{t_from}/to/{t_to}/{camera}" return self.request_json("GET", path)
def post_disease(self, station, t_from, t_to, data): """Get specified disease model for period""" station = clean.station(station) t_from, t_to = clean.time(t_from, t_to) path = f"/disease/{station}/from/{t_from}/to/{t_to}" return self.request_json("POST", path, data)
def get_disease(self, station, t_from, t_to): """Get Evapotranspiration for specified period""" station = clean.station(station) t_from, t_to = clean.time(t_from, t_to) path = f"/disease/{station}/from/{t_from}/to/{t_to}" return self.request_json("GET", path)