Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1.05 KB

README.md

File metadata and controls

49 lines (35 loc) · 1.05 KB

apixu-go

GoDoc Build Status Go Report Card

Golang library for Apixu Weather API http://www.apixu.com

Installation

$ go get github.com/mohan3d/apixu-go

Usage

package main

import (
	"fmt"

	"github.com/mohan3d/apixu-go"
)

func main() {
	client := apixu.NewClient("<APIXU_KEY>")

	current, err := client.Current("Paris")

	if err != nil {
		panic(err)
	}

	fmt.Printf("%v °C, %v °F\n", current.Current.TempC, current.Current.TempF)

	forecast, err := client.Forecast("London", 3)

	if err != nil {
		panic(err)
	}

	fmt.Printf("%v\n", forecast.Location.Country)
}

Testing

APIXU_KEY must be exported to environment variables before running tests.

$ export APIXU_KEY=<YOUR_APIXU_KEY>