Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.
/ go-darksky Public archive

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

License

Notifications You must be signed in to change notification settings

twpayne/go-darksky

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published