An open API service indexing awesome lists of open source software.

https://github.com/mohan3d/apixu-go

Golang library for Apixu Weather API http://www.apixu.com
https://github.com/mohan3d/apixu-go

api-client api-wrapper apixu client go golang wrapper

Last synced: 5 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# apixu-go
[![GoDoc](https://godoc.org/github.com/mohan3d/apixu-go?status.svg)](https://godoc.org/github.com/mohan3d/apixu-go)
[![Build Status](https://api.travis-ci.org/mohan3d/apixu-go.svg?branch=master)](https://travis-ci.org/mohan3d/apixu-go)
[![Go Report Card](https://goreportcard.com/badge/github.com/mohan3d/apixu-go)](https://goreportcard.com/report/github.com/mohan3d/apixu-go)

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

## Installation
```bash
$ go get github.com/mohan3d/apixu-go
```

## Usage
```go
package main

import (
"fmt"

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

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

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.

```bash
$ export APIXU_KEY=
```