go-weather-api
한국 공공데이터 포털(data.go.kr) 기반하여 기상청 데이터를 가져오는 go wrapper
사용법
package main
import (
"fmt"
"time"
"github.com/hsnks100/go-weather-api/providers/kweather"
)
func main() {
const serviceKey = "****************"
ks := kweather.NewClient(serviceKey)
wi2, err := ks.GetDetailedForecast("가산동", 16*time.Hour)
if err != nil {
fmt.Println(err)
}
for _, v := range wi2 {
fmt.Println(v)
}
fmt.Println(ks.ReportWeather(wi2))
}
결과
{30 0 0 70 0 4 24 0 0 0 0 0 186 0 0 2024-06-15 00:00:00 +0900 KST}
{20 0 0 75 0 3 23 0 0 0 1 0 186 1 0 2024-06-15 01:00:00 +0900 KST}
{30 0 0 75 0 4 22 0 0 0 0 0 201 0 0 2024-06-15 02:00:00 +0900 KST}
{30 0 0 75 0 4 22 0 0 0 1 0 180 1 0 2024-06-15 03:00:00 +0900 KST}
{30 0 0 80 0 4 22 0 0 0 0 0 225 0 0 2024-06-15 04:00:00 +0900 KST}
{30 0 0 80 0 4 22 0 0 0 0 0 18 0 0 2024-06-15 05:00:00 +0900 KST}
{30 0 0 80 0 4 22 19 0 0 0 0 269 0 0 2024-06-15 06:00:00 +0900 KST}
{30 0 0 80 0 4 22 0 0 0 0 0 144 0 0 2024-06-15 07:00:00 +0900 KST}
{30 0 0 75 0 4 23 0 0 0 0 0 221 0 0 2024-06-15 08:00:00 +0900 KST}
{30 0 0 70 0 4 24 0 0 0 1 0 209 1 0 2024-06-15 09:00:00 +0900 KST}
{60 1 8 70 0 4 24 0 0 1 1 0 227 1 0 2024-06-15 10:00:00 +0900 KST}
{20 0 0 70 0 3 25 0 0 2 0 0 260 2 0 2024-06-15 11:00:00 +0900 KST}
{20 0 0 70 0 3 26 0 0 2 0 0 278 2 0 2024-06-15 12:00:00 +0900 KST}
{60 1 1 70 0 4 27 0 0 2 0 0 288 2 0 2024-06-15 13:00:00 +0900 KST}
{30 0 0 65 0 4 27 0 0 2 0 0 278 2 0 2024-06-15 14:00:00 +0900 KST}
{30 0 0 65 0 4 27 0 30 2 0 0 270 2 0 2024-06-15 15:00:00 +0900 KST}
{30 0 0 65 0 4 27 0 0 2 0 0 268 2 0 2024-06-15 16:00:00 +0900 KST}
[날씨 요약]
날짜 및 시간: 2024-06-15 00:00:00~2024-06-15 16:00:00
기온: 22~27°C
강수확률: 60
강수량: 8mm
하늘상태: 흐림
습도: 80%
TODO
[] weatherapi 에서 제공하는 기능을 모두 구현해보기