go-openweather/README.md
2020-01-22 15:40:23 +01:00

926 B

About

This Repo contains golang library to query OpenWetherMaps (http://openweathermap.org/) for weather information.

Install

go get github.com/EricNeid/openweather

Documentation

Is available on godoc:

https://godoc.org/github.com/EricNeid/go-openweather

Examples

Consuming the library:

import "github.com/EricNeid/openweather"

// create a query
q := openweather.NewQueryForCity(readAPIKey(), "Berlin,de")

// obtain data
resp, err := q.Weather()

// enjoy
fmt.Println(resp.Name) // Berlin
fmt.Println(resp.Weather[0].Description) // misc
fmt.Println(resp.Main.Temp) // 1

See the test files for more example.

A simple client for testing is also included:

go build cmd/openweatherclient
openweatherclient -key <OpenWeather API Key> -city Berlin,de