Unofficial golang library for Big Data Cloud.
package main
import (
"fmt"
"github.com/evalphobia/bigdatacloud-go/config"
"github.com/evalphobia/bigdatacloud-go/bigdatacloud"
)
func main() {
conf := config.Config{
// you can set auth values to config directly, otherwise used from environment variables.
APIKey: "<your API Key>",
Language: "en", // default=en
Debug: false,
}
svc, err := bigdatacloud.New(conf)
if err != nil {
panic(err)
}
// execute score API
resp, err := svc.IPGeolocationFull("8.8.8.8")
if err != nil {
panic(err)
}
if resp.HasError() {
panic(fmt.Errorf("code=[%s] description=[%s]", resp.ErrData.Code, resp.ErrData.Description))
}
// just print response in json format
b, _ := json.Marshal(resp)
fmt.Printf("%s", string(b))
}
see example dir for more examples, and see official API document for more details (especially request/response).
Name | Description |
---|---|
BIGDATACLOUD_APIKEY |
Big Data Cloud API Key. |
BIGDATACLOUD_LANGUAGE |
Big Data Cloud localityLanguage. |