Skip to main content

Add your description here

Project description

🖨️ Klipper JSON-RPC クライアント

Klipper(Moonraker)と通信するためのPython WebSocket JSON-RPCクライアントライブラリです。

✨ 特徴

  • 🔄 非同期・同期両方のAPIをサポート
  • 🔌 WebSocketを使用した簡単なKlipper通信
  • 🎯 カスタム通知ハンドラーのサポート
  • 🔒 スレッドセーフな操作

🚀 インストール方法

📝 使用例

基本的な使い方

from klipper_jsonrpc import KlipperClient

# クライアントのインスタンスを作成
client = KlipperClient()

# Klipper WebSocketに接続
client.run("ws://your-klipper-host/websocket")

# 同期的にリクエストを送信
response = client.sync_send_request("printer.info")
print(response)

# カスタム通知ハンドラーを追加
def on_status_update(data):
    print(f"ステータス更新: {data}")

client.add_method_process("notify_proc_stat_update", on_status_update)

# 接続を閉じる
client.sync_close()

非同期での使用例

import asyncio
from klipper_jsonrpc import KlipperClient

async def main():
    client = KlipperClient()
    await client.connect("ws://your-klipper-host/websocket")
    
    response = await client.async_send_request("printer.info")
    print(response)
    
    await client.close()

asyncio.run(main())

💻 動作環境

  • Python 3.7以上
  • aiohttp 3.11.0以上

🔧 主な機能

  • WebSocketを使用したKlipperとの双方向通信
  • JSON-RPCプロトコルによるメッセージング
  • カスタムイベントハンドラーの登録機能
  • スレッドセーフな同期・非同期API

📚 API ドキュメント

KlipperClient クラス

メソッド一覧

  • run(url): クライアントの接続を開始します
  • sync_send_request(method, params=None): 同期的にリクエストを送信します
  • async_send_request(method, params=None): 非同期でリクエストを送信します
  • add_method_process(method, func): カスタムメソッドハンドラーを追加します
  • sync_close(): 接続を同期的に終了します
  • close(): 接続を非同期で終了します

🤝 コントリビューション

バグ報告や機能要望は、GitHubのIssueにて受け付けています。 プルリクエストも大歓迎です!

⚖️ ライセンス

📞 サポート

ご不明な点がございましたら、GitHubのIssueにてお問い合わせください。

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

klipper_jsonrpc-0.1.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

klipper_jsonrpc-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file klipper_jsonrpc-0.1.0.tar.gz.

File metadata

  • Download URL: klipper_jsonrpc-0.1.0.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for klipper_jsonrpc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0191615401c492691b14477c32588ca3b30463a03bca995715292ade48d1eef5
MD5 c9ee50110498b0ed4b6fe36fe4ea9e7b
BLAKE2b-256 e3d00b44355350a4ed2a94d556a4e987b87688bab1cfbe5b4c7a95fe51896000

See more details on using hashes here.

File details

Details for the file klipper_jsonrpc-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for klipper_jsonrpc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0336db455e15867021842fd3924c68dcf0a8b3f4a3d38d91830c921816f98add
MD5 1d7ebac3272cbedc0d835ffbcdabdb05
BLAKE2b-256 14cdeafda09a756cafb54a38656b66e9faf27d85bd8aee5b942c8e7b17f0273a

See more details on using hashes here.

Supported by

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