Skip to content

int128/go-yahoo-weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.