twpayne / go-darksky

Package darksky implements a client for the Dark Sky API. See https://darksky.net/dev.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-darksky

PkgGoDev Coverage Status

Package darksky implements a client for the Dark Sky weather forecasting API.

Key features

  • Support for all Dark Sky API functionality.
  • Idomatic Go API, including support for context and Go modules.
  • Language matching.
  • Rich handling of errors, including both bad requests generic HTTP errors.
  • Fully tested, including error conditions.
  • Mock client for offline testing.
  • Monitoring hooks.

Example

func ExampleClient_Forecast() {
	c := darksky.NewClient(
		darksky.WithKey(os.Getenv("DARKSKY_KEY")),
	)

	ctx := context.Background()
	forecast, err := c.Forecast(ctx, 42.3601, -71.0589, nil, &darksky.ForecastOptions{
		Units: darksky.UnitsSI,
	})
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(forecast)
}

License

MIT

About

Package darksky implements a client for the Dark Sky API. See https://darksky.net/dev.

License:MIT License


Languages

Language:Go 99.6%Language:Makefile 0.4%