Skip to main content

Unofficial zutool (頭痛ール: https://zutool.jp/) API Wrapper

Project description

zutool

PyPI version Maintainability pre-commit.ci status Test Coverage Test

ghcr latest ghcr size

Unofficial zutool (頭痛ール: https://zutool.jp/) API Wrapper

Install

pip install zutool

As Library

import zutool as z

# see: <https://nlftp.mlit.go.jp/ksj/gml/codelist/PrefCd.html>
area_code = "13" # 東京都
z.get_pain_status(area_code)

keyword = "東京都"
z.get_weather_point(keyword)

# see: <https://geoshape.ex.nii.ac.jp/city/code/?13113>
city_code = "13113" # 東京都渋谷区
z.get_weather_status(city_code)

As CLI

$ zutool -h
usage: zutool [-h] [-j] {pain_status,ps,weather_point,wp,weather_status,ws} ...

Get info of zutool <https://zutool.jp/>.

positional arguments:
  {pain_status,ps,weather_point,wp,weather_status,ws}
    pain_status (ps)                              get pain status by prefecture
    weather_point (wp)                            search weather point
    weather_status (ws)                           get pain status by city

optional arguments:
  -h, --help                                      show this help message and exit
  -j, --json                                      print as json (default: False)

pain_status (ps)

$ zutool ps -h
usage: zutool pain_status [-h] [-s Weather Point] area_code

positional arguments:
  area_code             see: <https://nlftp.mlit.go.jp/ksj/gml/codelist/PrefCd
                        .html> (ex. `13`)

optional arguments:
  -h, --help            show this help message and exit
  -s Weather Point, --set-weather-point Weather Point
                        set weather point code as default (ex. `13113`)
$ zutool ps 01
             今のみんなの体調は? <北海道|01>
                 (集計時間: 12時-18時台)
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ 😃😃😃😃😃😃😃😃 17.098445595855%                      ┃
┃ 😐😐😐😐😐😐😐😐😐😐😐😐😐😐😐 31.60621761658%         ┃
┃ 😞😞😞😞😞😞😞😞😞😞😞😞😞😞😞😞😞😞 37.823834196891%  ┃
┃ 🤯🤯🤯🤯🤯🤯 13.471502590674%                          ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ [😃・・・普通, 😐・・・少し痛い, 😞・・・痛い, 🤯・・・かなり痛い] │
└────────────────────────────────────────────────────────┘

weather_point (wp)

$ zutool wp -h
usage: zutool weather_point [-h] [-k] keyword

positional arguments:
  keyword     keyword for searching city_code (ex. `東京都`)

optional arguments:
  -h, --help  show this help message and exit
  -k, --kata  with kata column in non-json output
$ zutool wp "港区"
        「港区」の検索結果
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓
┃ 地域コード ┃ 地域名             ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
│ 13103      │ 東京都港区         │
│ 23111      │ 愛知県名古屋市港区 │
│ 27107      │ 大阪府大阪市港区   │
└────────────┴────────────────────┘

weather_status (ws)

$ zutool ws -h
usage: zutool weather_status [-h] city_code

positional arguments:
  city_code   see: <https://geoshape.ex.nii.ac.jp/city/code/> (ex. `13113`)

optional arguments:
  -h, --help  show this help message and exit
                                           東京都渋谷区の気圧予報
                                          2023-07-25 19:00:00+09:00
┏━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ 0      ┃ 1      ┃ 2      ┃ 3      ┃ 4      ┃ 5      ┃ 6      ┃ 7      ┃ 8      ┃ 9      ┃ 10     ┃ 11     ┃
┡━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ ☼      │ ☼      │ ☼      │ ☼      │ ☁      │ ☁      │ ☁      │ ☁      │ ☁      │ ☼      │ ☼      │ ☼      │
│ 25.9℃  │ 25.1℃  │ 24.7℃  │ 24.9℃  │ 24.7℃  │ 24.7℃  │ 25.7℃  │ 28.0℃  │ 29.3℃  │ 31.2℃  │ 33.1℃  │ 33.8℃  │
│ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │
│ 1015.7 │ 1015.5 │ 1015.4 │ 1015.2 │ 1015.5 │ 1015.7 │ 1015.8 │ 1015.9 │ 1015.7 │ 1015.6 │ 1015.4 │ 1015.1 │
│ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │
└────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
┏━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ 12     ┃ 13     ┃ 14     ┃ 15     ┃ 16     ┃ 17     ┃ 18     ┃ 19     ┃ 20     ┃ 21     ┃ 22     ┃ 23     ┃
┡━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │ ☼      │
│ 34.7℃  │ 35.9℃  │ 35.7℃  │ 35.1℃  │ 34.7℃  │ 33.1℃  │ 31.2℃  │ 30.3℃  │ 29.6℃  │ 28.3℃  │ 27.6℃  │ 27.2℃  │
│ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │ ↗      │
│ 1014.8 │ 1014.3 │ 1014.2 │ 1014.2 │ 1014.4 │ 1014.2 │ 1014.5 │ 1014.5 │ 1015.3 │ 1016.0 │ 1015.8 │ 1015.8 │
│ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │ 通常_0 │
└────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zutool-0.0.3.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

zutool-0.0.3-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page