2019-04-08 14:49:07 +03:00
|
|
|
package dadata
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2019-04-08 14:55:04 +03:00
|
|
|
func ExampleClient_GeoIP() {
|
2019-04-08 14:49:07 +03:00
|
|
|
daData := NewClient()
|
|
|
|
|
|
|
|
geoIPResponse, err := daData.GeoIP("83.220.54.223")
|
|
|
|
if nil != err {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if geoIPResponse.Location == nil {
|
|
|
|
fmt.Println("empty result from GeoIP")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
address := geoIPResponse.Location.Data
|
|
|
|
fmt.Println(address.Country)
|
|
|
|
fmt.Println(address.City)
|
|
|
|
fmt.Printf("see on https://www.google.com/maps/@%s,%sf,14z\n", address.GeoLat, address.GeoLon)
|
|
|
|
}
|