Exemplo n.º 1
0
def fetch_wunderground(self, station, date):
    try:
        logger.info("Fetching {}".format(station))
        data = capture_date_range(station, date)
        # data = [datum]
    except Exception as e:
        logger.error("Error fetching from {} at {}: {}".format(station, date, e))
    try:
        logger.info("Saving {}".format(station))
        if len(data) > 0:
            save(data, schema="Municipio", table="Clima_wu")
    except Exception as e:
        logger.error("Error saving to db with {} at {}: {}".format(station, date, e))
Exemplo n.º 2
0
def fetch_wunderground(self, station, date):
    try:
        logger.info("Fetching {}".format(station))
        data = capture_date_range(station, date)
        # data = [datum]
    except Exception as e:
        logger.error("Error fetching from {} at {}: {}".format(
            station, date, e))
    try:
        logger.info("Saving {}".format(station))
        if len(data) > 0:
            save(data, schema='Municipio', table='Clima_wu')
    except Exception as e:
        logger.error("Error saving to db with {} at {}: {}".format(
            station, date, e))
Exemplo n.º 3
0
 def test_capture_range(self):
     station_code = 'SBAF'
     date = datetime(2015, 11, 2)
     data = capture_date_range(station_code, date)
     self.assertIsInstance(data, list)