Exemple #1
0
        public WeatherData CollectData()
        {
            string      dataJson    = _webParser.GetData("https://api.tomorrow.io/v4/timelines?&timesteps=current&fields=temperature,humidity,windSpeed,windDirection,precipitationType,cloudCover&location=59.791891,30.264067&apikey=" + _apiKey);
            WeatherData weatherData = FillWeatherData(dataJson);

            if (weatherData.IsNotEmpty())
            {
                return(weatherData);
            }
            else
            {
                throw new EmptyWeatherDataException("tomorrow.io gave bad responce and weather data is not filled properly");
            }
        }
Exemple #2
0
        public WeatherData CollectData()
        {
            string dataJson = _webParser.GetData("https://api.openweathermap.org/data/2.5/weather?q=Saint%20Petersburg,%20RU&id=524901&appid=" + _apiKey);

            WeatherData weatherData = FillWeatherData(dataJson);

            if (weatherData.IsNotEmpty())
            {
                return(weatherData);
            }
            else
            {
                throw new EmptyWeatherDataException("openweathermap.org gave bad responce and weather data is not filled properly");
            }
        }
        public WeatherData CollectData()
        {
            string dataJson = _webParser.GetData(_url + _apiKey);

            WeatherData weatherData = FillWeatherData(dataJson);

            if (weatherData.IsNotEmpty())
            {
                return(weatherData);
            }
            else
            {
                throw new EmptyWeatherDataException("Website gave bad responce and weather data is not filled properly");
            }
        }