Go to file
2020-07-17 14:02:07 +02:00
.github/workflows Create go.yml 2020-07-17 09:19:11 +02:00
cmd/openweatherclient Fixed missing dot in import path 2020-01-22 15:50:41 +01:00
internal/verify Changed module name 2020-01-22 15:40:23 +01:00
.gitignore Initial commit 2019-12-09 15:09:21 +01:00
.gitpod.yml Update gitpod configuration 2020-07-17 07:42:09 +00:00
api.go Update readme 2019-12-10 07:34:15 +01:00
go.mod Fixed missing dot in import path 2020-01-22 15:50:41 +01:00
go.sum Initial commit 2019-12-09 15:09:21 +01:00
integration_test.go Separate unit and integration tests 2020-07-17 09:18:32 +02:00
LICENSE Initial commit 2019-12-09 15:09:21 +01:00
Makefile Initial commit 2019-12-09 15:09:21 +01:00
model.go Initial commit 2019-12-09 15:09:21 +01:00
openweather.go Update readme 2019-12-10 07:34:15 +01:00
query_test.go Separate unit and integration tests 2020-07-17 09:18:32 +02:00
query.go Initial commit 2019-12-09 15:09:21 +01:00
README.md Markdown lint 2020-07-17 14:00:26 +02:00

Go Report Card Go Go Doc Release Gitpod Ready-to-Code

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