go-yahoo-weather

module
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2020 License: Apache-2.0

README

go-yahoo-weather GoDoc CircleCI codecov

This is a Yahoo Japan Weather API Client for Go language.

You need to get an API Client ID on Yahoo Japan Developers Network.

See GoDoc.

Examples

package main

import (
	"log"
	"os"

	"github.com/int128/go-yahoo-weather/weather"
)

func main() {
	c := weather.NewClient(os.Getenv("YAHOO_CLIENT_ID"))
	resp, err := c.Get(&weather.Request{
		Coordinates: []weather.Coordinates{
			{Latitude: 35.663613, Longitude: 139.732293},  // Roppongi
			{Latitude: 41.7686738, Longitude: 140.728924}, // Hakodate
		},
	})
	if err != nil {
		log.Fatalf("Could not get weather: %s", err)
	}
	log.Printf("Weather response: %+v", resp)

	weathers, err := weather.Parse(resp)
	if err != nil {
		log.Fatalf("Could not parse weather response: %s", err)
	}
	log.Printf("Weathers: %+v", weathers)
}

See also example/main.go.

Contributions

This is an open source software licensed under Apache License 2.0.

Feel free to open issues and pull requests for improving code and documents.

Directories

Path Synopsis
Package weather provides a client for YOLP Weather API, described as https://developer.yahoo.co.jp/webapi/map/openlocalplatform/v1/weather.html
Package weather provides a client for YOLP Weather API, described as https://developer.yahoo.co.jp/webapi/map/openlocalplatform/v1/weather.html

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL