mirror of
https://github.com/EricNeid/go-openweather.git
synced 2025-01-10 15:05:07 +00:00
.github/workflows | ||
cmd/openweatherclient | ||
internal/verify | ||
.gitignore | ||
.gitpod.yml | ||
api.go | ||
go.mod | ||
go.sum | ||
integration_test.go | ||
LICENSE | ||
Makefile | ||
model.go | ||
openweather.go | ||
query_test.go | ||
query.go | ||
README.md |
About
This Repo contains golang library to query OpenWetherMaps (http://openweathermap.org/) for weather information.
- current weather: http://openweathermap.org/current
- 5 days forecast: http://openweathermap.org/forecast5
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