weather_forecast

Get weather forecast with the D programming language. It first gets your longitude and latitude using http://ipinfo.io. Then uses them to look up your weather using http://forecast.weather.gov.

Home page: https://github.com/workhorsy/d-weather-forecast

Members

Functions

getForecast
void getForecast(void delegate(WeatherData weather_data, Exception err) cb)

Returns the weather forecast using a callback.

Structs

WeatherData
struct WeatherData

Data gathered in WeatherData:

Examples

1 import std.stdio : stdout, stderr;
2 import weather_forecast : getForecast, WeatherData;
3 
4 getForecast(delegate(WeatherData weather_data, Exception err) {
5 	if (err) {
6 		stderr.writefln("%s", err);
7 	} else {
8 		stdout.writefln("latitude: %s", weather_data.latitude);
9 		stdout.writefln("longitude: %s", weather_data.longitude);
10 		stdout.writefln("city: %s", weather_data.city);
11 		stdout.writefln("region: %s", weather_data.region);
12 		stdout.writefln("country: %s", weather_data.country);
13 		stdout.writefln("postal: %s", weather_data.postal);
14 		stdout.writefln("temperature: %s", weather_data.temperature);
15 		stdout.writefln("summary: %s", weather_data.summary);
16 	}
17 });

Meta

Version

1.3.0

License

Boost Software License - Version 1.0