Metadata-Version: 2.4
Name: klipper-jsonrpc
Version: 0.2.0
Summary: Add your description here
Author-email: Rui Kobayashi <roboroborx782@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Rui Kobayashi
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: aiohttp>=3.11.16
Description-Content-Type: text/markdown

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

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

## ✨ 特徴

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

## 🚀 インストール方法

## 📝 使用例

### 基本的な使い方

```python
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()
```

### 非同期での使用例

```python
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にてお問い合わせください。
