示例#1
0
                    precipProbability REAL, \
                    precipType TEXT, \
                    pressure REAL, \
                    summary TEXT, \
                    temperature REAL, \
                    uvIndex REAL, \
                    visibility REAL, \
                    windBearing REAL, \
                    windGust REAL, \
                    windSpeed REAL, \
                    precipSigned REAL, \
                    PRIMARY KEY(Location, time));" % table_name)

        self.conn.commit()


if __name__ == '__main__':

    db = DatabaseConnection()

    ds = darksky.DarkSky()
    current_df = ds.get_past_week_darksky(loc_dict)
    db.add_darksky(current_df, 'ds_current')

    forecast_df = ds.get_nextweek_darksky(loc_dict)

    # We have to drop existing forecasts before adding new ones
    db.drop_table('ds_forecasts')
    db.create_darksky_table('ds_forecasts')
    db.add_darksky(forecast_df, 'ds_forecasts')
示例#2
0
def test_get_next_week_darksky_returns_df():

    ds = darksky.DarkSky()
    df = ds.get_nextweek_darksky(loc_dict, daily=False)

    assert isinstance(df, pd.DataFrame)
示例#3
0
def test_darksky_class_returns_df():

    ds = darksky.DarkSky()
    df = ds.df_template()

    assert isinstance(df, pd.DataFrame)
示例#4
0
def test_get_past_week_darksky_returns_df():

    ds = darksky.DarkSky()
    df = ds.get_past_week_darksky(loc_dict)

    assert isinstance(df, pd.DataFrame)
示例#5
0
文件: whit.py 项目: blackmatt37/whit
def getWeather(zipCode):
    (lat, lon) = geocode(zipCode)
    ds_interface = darksky.DarkSky(fio_api)
    cw = current_weather = ds_interface.getWeather(latitude = lat, longitude=lon)
    return [str(cw.currently["temperature"]) + " degrees F"]