Skip to content

mohan3d/apixu-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>