WeerLive 1.0.0
See the version list below for details.
dotnet add package WeerLive --version 1.0.0
NuGet\Install-Package WeerLive -Version 1.0.0
<PackageReference Include="WeerLive" Version="1.0.0" />
paket add WeerLive --version 1.0.0
#r "nuget: WeerLive, 1.0.0"
// Install WeerLive as a Cake Addin #addin nuget:?package=WeerLive&version=1.0.0 // Install WeerLive as a Cake Tool #tool nuget:?package=WeerLive&version=1.0.0
WeerLive.Net
WeerLive.Net is a library for the Dutch weather service WeerLive. This library provides the following features:
- Get the live weather for a location
- Get the weather forecast for the coming 24 hours for a location
- Get the weather forecast for the coming 5 days for a location
The location can be either a city name or latitude and longitude coordinates.
Usage
Here you can see a simple example of how to use the library combined with the Microsoft.Extensions.DependencyInjection library. This example can also be found in the example project.
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureServices((ctx, services) =>
services.AddWeerLive(conf => ctx.Configuration.GetSection("WeerLive").Bind(conf)));
var host = builder.Build();
var serviceScope = host.Services.CreateScope();
var client = serviceScope.ServiceProvider.GetRequiredService<IWeerLiveClient>();
var logger = serviceScope.ServiceProvider.GetRequiredService<ILogger<Program>>();
var forecast = await client.GetAsync("Amsterdam");
if (forecast?.LiveWeather is null)
{
logger.LogError("Failed to get weather forecast.");
return;
}
logger.LogInformation("Today in Amsterdam: {Temperature}°C with a RH of {Humidity}%.",
forecast.LiveWeather.Temperature,
forecast.LiveWeather.Humidity);
And without dependency injection:
var httpClient = new HttpClient();
var options = new WeerLiveOptions
{
ApiKey = "demo"
};
var client = new WeerLiveClient(httpClient, Options.Create(options));
var forecast = await client.GetAsync("Amsterdam");
if (forecast?.LiveWeather is null)
{
Console.WriteLine("Failed to get weather forecast.");
return;
}
Console.WriteLine($"Today in Amsterdam: {forecast.LiveWeather.Temperature}°C with a RH of {forecast.LiveWeather.Humidity}%.");
API key
To use the WeerLive API, you need an API key. You can get a free API key by registering on the WeerLive website. With an API key you can make up to 300 requests per day. In the responses you can find how many requests you have left for the day.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.