Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.24 KB

File metadata and controls

38 lines (26 loc) · 1.24 KB

OpenWeatherMap4NET

Logo

Getting Started

  1. First install .NET Core >= 2.0 for your platform.
  2. Install the OpenWeatherMap4NET NuGet Package.
  3. Request an API key from openweathermap.org

Usage Example

Here is a short usage example for using the service to request the temperature information for 'London':

// build the service
var service = new OpenWeatherMapService(new OpenWeatherMapOptions
{
    ApiKey = "[INSERT OPENWEATHERMAP.ORG TOKEN HERE]"
});

// set global unit to Metric, so temperatures are in Celsius and speed units in meter/sec.
RequestOptions.Default.Unit = UnitType.Metric;

// request weather information for "London"
var weather = await service.GetCurrentWeatherAsync("London");

// print out current temperature
Console.WriteLine(weather.Temperature.Value); // -> 20,4

Dependencies