Skip to main content

axis.py

AXIS リアルタイム情報配信サービス用のPythonクライアントライブラリです。

特徴

  • シンプルなデコレータAPI — @client.on("channel") でメッセージハンドラを登録
  • 自動再接続 — Exponential Backoff アルゴリズムによる再接続
  • 型付きメッセージモデル — 各チャンネルのメッセージを dataclass で型定義
  • トークン管理 — トークンリフレッシュAPIに対応

対応チャンネル

チャンネル 説明 モデル
eew 緊急地震速報 (beta) EEWMessage
quake-one 地震概要・震度情報 QuakeOneMessage
breaking-news ニュース速報 (beta) BreakingNewsMessage
jmx-seismology 気象庁電文(地震) JMXSeismologyMessage
jmx-meteorology 気象庁電文(気象) JMXMeteorologyMessage
jmx-volcanology 気象庁電文(火山) JMXVolcanologyMessage

インストール

pip install axis-prioris

使い方

基本

from axis import AxisClient

client = AxisClient(token="YOUR_TOKEN")

@client.on("eew")
def on_eew(message):
    print(f"緊急地震速報: M{message.Magnitude} {message.Hypocenter.Name}")

@client.on("quake-one")
def on_quake(message):
    print(f"地震情報: {message.headline}")

@client.on("breaking-news")
def on_news(message):
    print(f"速報: {message.Title}")
    for line in message.Text:
        print(f"  {line}")

client.start()  # ブロッキング接続

全チャンネルの受信

@client.on_all
def on_any(channel, message):
    print(f"[{channel}] {message}")

非ブロッキング接続

thread = client.start_async()

# ... 他の処理 ...

client.stop()
thread.join()

接続イベント

@client.on_connect
def connected():
    print("AXIS に接続しました")

@client.on_error
def error(err):
    print(f"エラー: {err}")

@client.on_close
def closed(code, msg):
    print(f"切断 (code={code})")

トークンリフレッシュ

try:
    new_token = client.refresh_token()
    print(f"トークンを更新しました")
except AxisTokenExpiredError:
    print("契約が期限切れです。Webサイトで再発行してください。")

設定オプション

client = AxisClient(
    token="YOUR_TOKEN",
    auto_reconnect=True,   # 自動再接続 (デフォルト: True)
    max_retries=10,        # 最大再接続回数 (デフォルト: 10)
    ping_interval=60,      # Heartbeat間隔 秒 (デフォルト: 60)
)

ログ

標準の logging モジュールを使用しています:

import logging
logging.basicConfig(level=logging.INFO)

ライセンス

MIT

Metadata

Release files for axis-prioris 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for axis-prioris 0.2.1
File Size Uploaded Provenance Actions
axis_prioris-0.2.1.tar.gz 11.5 kB With provenance Details for axis_prioris-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for axis-prioris 0.2.1
File Interpreter ABI Platform Actions
axis_prioris-0.2.1-py3-none-any.whl Python 3 none any Details for axis_prioris-0.2.1-py3-none-any.whl

Total release size: 23.0 kB

Release files / axis_prioris-0.2.1.tar.gz

Download URL axis_prioris-0.2.1.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
46fab9bfd7886309e347471eb6284e5c83a0618e5eb11aa94c5ad65ac6be1125
BLAKE2b-256 checksum
How to use checksums
3629efd1d85e7cd8978526b430394280599b3c33785f632b3db24732ea7b6471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 18, 2026.

Transparency log

Release files / axis_prioris-0.2.1-py3-none-any.whl

Download URL axis_prioris-0.2.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c946db97205b7ae7b8659471ec25f83da1f92dc36834ad23a962c1d915a204c
BLAKE2b-256 checksum
How to use checksums
9a89f9e8deb9e90df1e804f143e9825da2de58babd71a63a1dff7024afbbb927
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 18, 2026.

Transparency log

Security for axis-prioris 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for axis_prioris-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page