public static void TestWeatherAPI() { SeniverseWeatherClient client = new SeniverseWeatherClient(); string resp = client.GetRealTimeWeather("北京"); Console.WriteLine(resp); }
public override string GetAnswer(WBContext context, LUInfo luInfo) { string response = DatetimeUtils.GetOutofScopeAnswer(); string location = context.Location; TimeRange range = context.timeRange; if (range == null) { response = client.GetRealTimeWeather(location); } else if (!range.IsHourly) { response = client.GetPredictedWeatherDaily(location, range.startDate, range.endDate); } else { response = client.GetPredictedWeatherHourly(location, range.startDate, range.endDate); } return(response + "\r\n"); }