angelobreuer / OpenWeatherMap4NET

A wrapper for the OpenWeatherMap.org RESTful api service.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

A wrapper for the OpenWeatherMap.org RESTful api service.

License:MIT License


Languages

Language:C# 100.0%