make lib
This commit is contained in:
parent
28ee3a0f2e
commit
4fc91fae8f
@ -12,23 +12,6 @@ var apiKey = "7501365e9803ca244bf100fb41084538"
|
||||
var lat = "39.004608"
|
||||
var long = "-76.875671"
|
||||
|
||||
func main() {
|
||||
oneCallUrl := fmt.Sprintf("https://api.openweathermap.org/data/2.5/onecall?lat=%v&lon=%v&units=imperial&appid=%v", lat, long, apiKey)
|
||||
response, err := http.Get(oneCallUrl)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("The HTTP request failed with error %s\n", err)
|
||||
}
|
||||
data, _ := ioutil.ReadAll(response.Body)
|
||||
|
||||
var report OneCallReport
|
||||
err = json.Unmarshal(data, &report)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(TodayToReport(report.Daily[0]))
|
||||
}
|
||||
|
||||
func GetDailyReport() string {
|
||||
oneCallUrl := fmt.Sprintf("https://api.openweathermap.org/data/2.5/onecall?lat=%v&lon=%v&units=imperial&appid=%v", lat, long, apiKey)
|
||||
response, err := http.Get(oneCallUrl)
|
Loading…
Reference in New Issue
Block a user