Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.
/ kafun Public archive

Golang製の環境省花粉観測システムAPIのクライアントです。

Notifications You must be signed in to change notification settings

noissefnoc/kafun

Repository files navigation

kafun

GitHub Actions

DEPRECATED: 環境省花粉観測システム(愛称:はなこさん)事業の廃止に伴う花粉自動計測器を用いた花粉観測の終了について - 2021年12月24日にあるように、2022年以降該当のAPIサービスが停止されたため、このコマンドは利用できません。

Golang製の 環境庁花粉観測システムAPI のクライアントです。

アルファ版なので様々な変更の可能性があります

インストール

コマンド

現在(2021-04) go get ないしはローカル環境でのビルドのみの対応です。

go get github.com/noissefnoc/kafun/cmd/kafun

ないしは

git clone git@github.com:noissefnoc/kafun.git
cd kafun
go build -o kafun cmd/kafun/main.go

ライブラリ

go.modgithub.com/noissefnoc/kafun を追加してください。

使い方

コマンド

オプション

Usage of kafun:
  -endYM string
        終了年月 (format: yyyyMM)
  -sokuteikyokuCode string
        測定局コード
  -startYM string
        開始年月 (format: yyyyMM) (必須)
  -todofukenCode string
        都道府県コード (range: 01 to 47) (必須)

具体用例

kafun -startYM 202102 -endYM 202103 -todofukenCode 13 -sokuteikyokuCode 51320100

ライブラリ

package main

import (
	"context"
	"encoding/json"
	"fmt"
	
	"github.com/noissefnoc/kafun"
)

// エラー処理省略
func main() {
	client, _ := kafun.NewClient(kafun.DefaultURL)
	response, _ := client.Search(context.Background(), "202102", "202103", "13", "51320100")
	printJSON, _ := json.MarshalIndent(response[len(response) - 1], "", "\t") // 最新の測定データのみを表示対象にする
	fmt.Println(printJSON)
}

環境庁花粉測定システムAPI公式サイト

Author

noissefnoc@gmail.com

About

Golang製の環境省花粉観測システムAPIのクライアントです。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published