linebot-error-analyzer


Namelinebot-error-analyzer JSON
Version 3.0.1 PyPI version JSON
download
home_pagehttps://github.com/raiton-boo/linebot-error-analyzer
SummaryLINE Bot SDK のエラーを自動分析・診断するライブラリ
upload_time2025-08-17 17:20:34
maintainerNone
docs_urlNone
authorらいとん
requires_python>=3.9
licenseMIT
keywords linebot bot error analyzer messaging-api webhook diagnostics line chatbot
VCS
bugtrack_url
requirements pytest pytest-asyncio pytest-cov psutil typing_extensions black flake8 mypy sphinx sphinx-rtd-theme
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🤖 LINE Bot Error Analyzer

[![PyPI version](https://badge.fury.io/py/linebot-error-analyzer.svg)](https://badge.fury.io/py/linebot-error-analyzer)
[![Python](https://img.shields.io/pypi/pyversions/linebot-error-analyzer.svg)](https://pypi.org/project/linebot-error-analyzer/)
![GitHub Repo stars](https://img.shields.io/github/stars/raiton-boo/linebot-error-analyzer?style=social)
![GitHub issues](https://img.shields.io/github/issues/raiton-boo/linebot-error-analyzer)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://static.pepy.tech/badge/linebot-error-analyzer)](https://pepy.tech/project/linebot-error-analyzer)

LINE Bot 開発で発生するエラーを自動分析・診断する Python ライブラリです。

LINE Bot API のエラーレスポンス、例外、ログメッセージを解析し、エラーの種類を特定して具体的な解決策を提案します。開発者の生産性向上と LINE Bot の安定運用をサポートします。

**🚀 このライブラリは共同開発者・コントリビューターを募集中です!ご興味のある方は [Discord](https://discord.gg/6qYHH9HY) までご連絡ください。**

## 📋 要件

- **Python**: 3.9 以上(3.9, 3.10, 3.11, 3.12 でテスト済み)
- **LINE Bot SDK**: v2/v3 系に対応(オプション)
- **依存関係**: 標準ライブラリのみ(`typing_extensions`のみ追加)

## ✨ 特徴

- **🔍 自動エラー解析**: LINE Bot API のエラーレスポンス、例外、ログを自動で分類・診断
- **💡 具体的な対処法**: 各エラーに対する実用的な解決策とベストプラクティスを提案
- **⚡ 同期・非同期対応**: 同期処理と非同期処理の両方をサポート
- **🔄 SDK バージョン対応**: LINE Bot SDK v2/v3 系の両方に対応
- **🌐 フレームワーク統合**: Flask、FastAPI、aiohttp などと簡単に統合
- **📊 リトライ判定**: エラーのリトライ可否を自動判定
- **🏷️ エラー分類**: エラーを意味のあるカテゴリに自動分類

## インストール

### 基本インストール

```bash
pip install linebot-error-analyzer
```

### 開発環境用(テスト依存関係含む)

```bash
pip install linebot-error-analyzer[dev]
```

### LINE Bot SDK と一緒にインストール

```bash
# LINE Bot SDK v3 と一緒に
pip install linebot-error-analyzer linebot-sdk

# または全依存関係込み
pip install linebot-error-analyzer[all]
```

### 対応環境

- Python 3.9+
- Windows, macOS, Linux
- LINE Bot SDK v2/v3(オプション)

## 🚀 基本的な使用方法

```python
from linebot_error_analyzer import LineErrorAnalyzer

# アナライザーを初期化
analyzer = LineErrorAnalyzer()

# エラーメッセージ(ログメッセージから)を分析
error_message = "(401) Invalid channel access token"
result = analyzer.analyze(error_message)

print(f"エラーカテゴリ: {result.category.value}")  # AUTH_ERROR
print(f"対処法: {result.recommended_action}")
print(f"リトライ可能: {result.is_retryable}")  # False

# 辞書形式のエラーデータも分析可能
error_data = {
    "status_code": 429,
    "message": "Rate limit exceeded"
}
result2 = analyzer.analyze(error_data)
print(f"カテゴリ: {result2.category.value}")  # RATE_LIMIT
```

### 📝 サポートされる入力パターン

このライブラリは以下の形式のエラーを分析できます:

1. **エラーログメッセージ(文字列)**

   ```python
   analyzer.analyze("(401) Invalid channel access token")
   analyzer.analyze("429 Rate limit exceeded")
   ```

2. **辞書形式のエラーデータ**

   ```python
   analyzer.analyze({
       "status_code": 400,
       "message": "Bad Request"
   })
   ```

3. **LINE Bot SDK 例外(v2/v3)**

   ```python
   # SDK例外を直接渡すことが可能
   try:
       line_bot_api.reply_message(...)
   except LineBotApiError as e:
       analyzer.analyze(e)  # 例外オブジェクトを直接分析
   ```

4. **HTTP レスポンスオブジェクト**
   ```python
   # requests.Response オブジェクトなど
   response = requests.post(...)
   if not response.ok:
       analyzer.analyze(response)
   ```

## 🔗 LINE Bot SDK との統合

```python
from linebot.v3.messaging import ApiClient, MessagingApi
from linebot.v3.messaging.exceptions import ApiException
from linebot_error_analyzer import LineErrorAnalyzer

analyzer = LineErrorAnalyzer()

try:
    # LINE Bot API を呼び出し
    line_bot_api.reply_message(...)
except ApiException as e:
    # 例外を直接解析
    error_info = analyzer.analyze(e)

    if error_info.category.value == "RATE_LIMIT":
        wait_time = error_info.retry_after or 60
        print(f"レート制限エラー: {wait_time}秒後にリトライしてください")
    elif error_info.is_retryable:
        print("一時的なエラー - リトライを推奨")
    else:
        print(f"対処法: {error_info.recommended_action}")
```

## ⚡ 非同期処理

```python
import asyncio
from linebot_error_analyzer import AsyncLineErrorAnalyzer

async def analyze_errors():
    analyzer = AsyncLineErrorAnalyzer()

    # 単一エラーの非同期分析
    result = await analyzer.analyze("(401) Authentication failed")

    # 複数エラーの一括分析(バッチ処理)
    error_messages = [
        "(401) Invalid channel access token",
        "(429) Rate limit exceeded",
        "(400) Bad Request"
    ]
    results = await analyzer.analyze_batch(error_messages, batch_size=10)

    for result in results:
        print(f"エラー: {result.category.value} - {result.recommended_action}")

asyncio.run(analyze_errors())
```

## 📚 ドキュメント

### 詳細ガイド

- **[📖 インストールガイド](docs/installation.md)** - 詳細なセットアップ手順
- **[🚀 クイックスタート](docs/quickstart.md)** - すぐに始められるガイド
- **[🎯 使用例集](docs/examples/)** - 実際のプロジェクトでの活用例
- **[🔧 統合ガイド](docs/integration/)** - FastAPI、Flask との統合
- **[🐛 エラーリファレンス](docs/errors/)** - 全エラーコード詳細とトラブルシューティング

### 💻 実装例

本ライブラリには、実際の LINE Bot 開発で使用できる実装例を含んでいます:

- **[📁 Examples Collection](examples/)** - 実用的な LINE Bot 実装例
  - **`simple_usage.py`** - 基本的な使用方法のデモ
  - **`flask_echo_bot.py`** - Flask を使用したエコー Bot(エラー処理付き)
  - **`fastapi_echo_bot.py`** - FastAPI を使用した非同期エコー Bot
  - **`aiohttp_echo_bot.py`** - aiohttp を使用したフル非同期実装

これらの例は LINE Bot SDK の公式スタイルに準拠し、コピー&ペーストで実際のプロジェクトに使用できるよう設計されています。

詳細は [📖 Examples Guide](examples/README.md) をご覧ください。

## 主要エラーカテゴリ

| カテゴリ              | 説明               | 例                   |
| --------------------- | ------------------ | -------------------- |
| `AUTH_ERROR`          | 認証エラー         | 無効なトークン       |
| `RATE_LIMIT`          | API 呼び出し制限   | 429 エラー           |
| `INVALID_REPLY_TOKEN` | 無効な返信トークン | 期限切れトークン     |
| `USER_NOT_FOUND`      | ユーザー未発見     | 削除されたアカウント |
| `SERVER_ERROR`        | サーバーエラー     | 5xx 系エラー         |

詳細なエラーコード対応表は [📖 エラーリファレンス](docs/errors/line_api_codes.md) をご覧ください。

## 🔧 フレームワーク統合

### FastAPI との統合例

```python
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from linebot.v3.messaging.exceptions import ApiException
from linebot_error_analyzer import LineErrorAnalyzer

app = FastAPI()
analyzer = LineErrorAnalyzer()

@app.exception_handler(ApiException)
async def line_api_exception_handler(request, exc):
    error_info = analyzer.analyze(exc)
    return JSONResponse(
        status_code=error_info.status_code,
        content={
            "error": error_info.category.value,
            "message": error_info.message,
            "action": error_info.recommended_action,
            "retryable": error_info.is_retryable
        }
    )
```

## テスト実行

```bash
# 基本テスト実行
python -m pytest tests/ -v

# テスト用依存関係のインストール
pip install pytest pytest-asyncio
```

## ライセンス

MIT License

## 免責事項

このライブラリは**サードパーティ製**です。LINE 株式会社とは関係ありません。

## 参考リンク

- [LINE Messaging API リファレンス](https://developers.line.biz/ja/reference/messaging-api/)
- [LINE Bot SDK for Python](https://github.com/line/linebot-sdk-python)
- [LINE Developers](https://developers.line.biz/ja/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/raiton-boo/linebot-error-analyzer",
    "name": "linebot-error-analyzer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "linebot, bot, error, analyzer, messaging-api, webhook, diagnostics, line, chatbot",
    "author": "\u3089\u3044\u3068\u3093",
    "author_email": "raitosongwe@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/12/b1/2a7c333f7b04b089cc9515f29edab996987420d5cd3eb88e9b5632c57abc/linebot_error_analyzer-3.0.1.tar.gz",
    "platform": "any",
    "description": "# \ud83e\udd16 LINE Bot Error Analyzer\n\n[![PyPI version](https://badge.fury.io/py/linebot-error-analyzer.svg)](https://badge.fury.io/py/linebot-error-analyzer)\n[![Python](https://img.shields.io/pypi/pyversions/linebot-error-analyzer.svg)](https://pypi.org/project/linebot-error-analyzer/)\n![GitHub Repo stars](https://img.shields.io/github/stars/raiton-boo/linebot-error-analyzer?style=social)\n![GitHub issues](https://img.shields.io/github/issues/raiton-boo/linebot-error-analyzer)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://static.pepy.tech/badge/linebot-error-analyzer)](https://pepy.tech/project/linebot-error-analyzer)\n\nLINE Bot \u958b\u767a\u3067\u767a\u751f\u3059\u308b\u30a8\u30e9\u30fc\u3092\u81ea\u52d5\u5206\u6790\u30fb\u8a3a\u65ad\u3059\u308b Python \u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\n\nLINE Bot API \u306e\u30a8\u30e9\u30fc\u30ec\u30b9\u30dd\u30f3\u30b9\u3001\u4f8b\u5916\u3001\u30ed\u30b0\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u89e3\u6790\u3057\u3001\u30a8\u30e9\u30fc\u306e\u7a2e\u985e\u3092\u7279\u5b9a\u3057\u3066\u5177\u4f53\u7684\u306a\u89e3\u6c7a\u7b56\u3092\u63d0\u6848\u3057\u307e\u3059\u3002\u958b\u767a\u8005\u306e\u751f\u7523\u6027\u5411\u4e0a\u3068 LINE Bot \u306e\u5b89\u5b9a\u904b\u7528\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002\n\n**\ud83d\ude80 \u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u5171\u540c\u958b\u767a\u8005\u30fb\u30b3\u30f3\u30c8\u30ea\u30d3\u30e5\u30fc\u30bf\u30fc\u3092\u52df\u96c6\u4e2d\u3067\u3059\uff01\u3054\u8208\u5473\u306e\u3042\u308b\u65b9\u306f [Discord](https://discord.gg/6qYHH9HY) \u307e\u3067\u3054\u9023\u7d61\u304f\u3060\u3055\u3044\u3002**\n\n## \ud83d\udccb \u8981\u4ef6\n\n- **Python**: 3.9 \u4ee5\u4e0a\uff083.9, 3.10, 3.11, 3.12 \u3067\u30c6\u30b9\u30c8\u6e08\u307f\uff09\n- **LINE Bot SDK**: v2/v3 \u7cfb\u306b\u5bfe\u5fdc\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09\n- **\u4f9d\u5b58\u95a2\u4fc2**: \u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u307f\uff08`typing_extensions`\u306e\u307f\u8ffd\u52a0\uff09\n\n## \u2728 \u7279\u5fb4\n\n- **\ud83d\udd0d \u81ea\u52d5\u30a8\u30e9\u30fc\u89e3\u6790**: LINE Bot API \u306e\u30a8\u30e9\u30fc\u30ec\u30b9\u30dd\u30f3\u30b9\u3001\u4f8b\u5916\u3001\u30ed\u30b0\u3092\u81ea\u52d5\u3067\u5206\u985e\u30fb\u8a3a\u65ad\n- **\ud83d\udca1 \u5177\u4f53\u7684\u306a\u5bfe\u51e6\u6cd5**: \u5404\u30a8\u30e9\u30fc\u306b\u5bfe\u3059\u308b\u5b9f\u7528\u7684\u306a\u89e3\u6c7a\u7b56\u3068\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u63d0\u6848\n- **\u26a1 \u540c\u671f\u30fb\u975e\u540c\u671f\u5bfe\u5fdc**: \u540c\u671f\u51e6\u7406\u3068\u975e\u540c\u671f\u51e6\u7406\u306e\u4e21\u65b9\u3092\u30b5\u30dd\u30fc\u30c8\n- **\ud83d\udd04 SDK \u30d0\u30fc\u30b8\u30e7\u30f3\u5bfe\u5fdc**: LINE Bot SDK v2/v3 \u7cfb\u306e\u4e21\u65b9\u306b\u5bfe\u5fdc\n- **\ud83c\udf10 \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u7d71\u5408**: Flask\u3001FastAPI\u3001aiohttp \u306a\u3069\u3068\u7c21\u5358\u306b\u7d71\u5408\n- **\ud83d\udcca \u30ea\u30c8\u30e9\u30a4\u5224\u5b9a**: \u30a8\u30e9\u30fc\u306e\u30ea\u30c8\u30e9\u30a4\u53ef\u5426\u3092\u81ea\u52d5\u5224\u5b9a\n- **\ud83c\udff7\ufe0f \u30a8\u30e9\u30fc\u5206\u985e**: \u30a8\u30e9\u30fc\u3092\u610f\u5473\u306e\u3042\u308b\u30ab\u30c6\u30b4\u30ea\u306b\u81ea\u52d5\u5206\u985e\n\n## \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\n\n### \u57fa\u672c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\n\n```bash\npip install linebot-error-analyzer\n```\n\n### \u958b\u767a\u74b0\u5883\u7528\uff08\u30c6\u30b9\u30c8\u4f9d\u5b58\u95a2\u4fc2\u542b\u3080\uff09\n\n```bash\npip install linebot-error-analyzer[dev]\n```\n\n### LINE Bot SDK \u3068\u4e00\u7dd2\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\n\n```bash\n# LINE Bot SDK v3 \u3068\u4e00\u7dd2\u306b\npip install linebot-error-analyzer linebot-sdk\n\n# \u307e\u305f\u306f\u5168\u4f9d\u5b58\u95a2\u4fc2\u8fbc\u307f\npip install linebot-error-analyzer[all]\n```\n\n### \u5bfe\u5fdc\u74b0\u5883\n\n- Python 3.9+\n- Windows, macOS, Linux\n- LINE Bot SDK v2/v3\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09\n\n## \ud83d\ude80 \u57fa\u672c\u7684\u306a\u4f7f\u7528\u65b9\u6cd5\n\n```python\nfrom linebot_error_analyzer import LineErrorAnalyzer\n\n# \u30a2\u30ca\u30e9\u30a4\u30b6\u30fc\u3092\u521d\u671f\u5316\nanalyzer = LineErrorAnalyzer()\n\n# \u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\uff08\u30ed\u30b0\u30e1\u30c3\u30bb\u30fc\u30b8\u304b\u3089\uff09\u3092\u5206\u6790\nerror_message = \"(401) Invalid channel access token\"\nresult = analyzer.analyze(error_message)\n\nprint(f\"\u30a8\u30e9\u30fc\u30ab\u30c6\u30b4\u30ea: {result.category.value}\")  # AUTH_ERROR\nprint(f\"\u5bfe\u51e6\u6cd5: {result.recommended_action}\")\nprint(f\"\u30ea\u30c8\u30e9\u30a4\u53ef\u80fd: {result.is_retryable}\")  # False\n\n# \u8f9e\u66f8\u5f62\u5f0f\u306e\u30a8\u30e9\u30fc\u30c7\u30fc\u30bf\u3082\u5206\u6790\u53ef\u80fd\nerror_data = {\n    \"status_code\": 429,\n    \"message\": \"Rate limit exceeded\"\n}\nresult2 = analyzer.analyze(error_data)\nprint(f\"\u30ab\u30c6\u30b4\u30ea: {result2.category.value}\")  # RATE_LIMIT\n```\n\n### \ud83d\udcdd \u30b5\u30dd\u30fc\u30c8\u3055\u308c\u308b\u5165\u529b\u30d1\u30bf\u30fc\u30f3\n\n\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u4ee5\u4e0b\u306e\u5f62\u5f0f\u306e\u30a8\u30e9\u30fc\u3092\u5206\u6790\u3067\u304d\u307e\u3059\uff1a\n\n1. **\u30a8\u30e9\u30fc\u30ed\u30b0\u30e1\u30c3\u30bb\u30fc\u30b8\uff08\u6587\u5b57\u5217\uff09**\n\n   ```python\n   analyzer.analyze(\"(401) Invalid channel access token\")\n   analyzer.analyze(\"429 Rate limit exceeded\")\n   ```\n\n2. **\u8f9e\u66f8\u5f62\u5f0f\u306e\u30a8\u30e9\u30fc\u30c7\u30fc\u30bf**\n\n   ```python\n   analyzer.analyze({\n       \"status_code\": 400,\n       \"message\": \"Bad Request\"\n   })\n   ```\n\n3. **LINE Bot SDK \u4f8b\u5916\uff08v2/v3\uff09**\n\n   ```python\n   # SDK\u4f8b\u5916\u3092\u76f4\u63a5\u6e21\u3059\u3053\u3068\u304c\u53ef\u80fd\n   try:\n       line_bot_api.reply_message(...)\n   except LineBotApiError as e:\n       analyzer.analyze(e)  # \u4f8b\u5916\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u76f4\u63a5\u5206\u6790\n   ```\n\n4. **HTTP \u30ec\u30b9\u30dd\u30f3\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8**\n   ```python\n   # requests.Response \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3069\n   response = requests.post(...)\n   if not response.ok:\n       analyzer.analyze(response)\n   ```\n\n## \ud83d\udd17 LINE Bot SDK \u3068\u306e\u7d71\u5408\n\n```python\nfrom linebot.v3.messaging import ApiClient, MessagingApi\nfrom linebot.v3.messaging.exceptions import ApiException\nfrom linebot_error_analyzer import LineErrorAnalyzer\n\nanalyzer = LineErrorAnalyzer()\n\ntry:\n    # LINE Bot API \u3092\u547c\u3073\u51fa\u3057\n    line_bot_api.reply_message(...)\nexcept ApiException as e:\n    # \u4f8b\u5916\u3092\u76f4\u63a5\u89e3\u6790\n    error_info = analyzer.analyze(e)\n\n    if error_info.category.value == \"RATE_LIMIT\":\n        wait_time = error_info.retry_after or 60\n        print(f\"\u30ec\u30fc\u30c8\u5236\u9650\u30a8\u30e9\u30fc: {wait_time}\u79d2\u5f8c\u306b\u30ea\u30c8\u30e9\u30a4\u3057\u3066\u304f\u3060\u3055\u3044\")\n    elif error_info.is_retryable:\n        print(\"\u4e00\u6642\u7684\u306a\u30a8\u30e9\u30fc - \u30ea\u30c8\u30e9\u30a4\u3092\u63a8\u5968\")\n    else:\n        print(f\"\u5bfe\u51e6\u6cd5: {error_info.recommended_action}\")\n```\n\n## \u26a1 \u975e\u540c\u671f\u51e6\u7406\n\n```python\nimport asyncio\nfrom linebot_error_analyzer import AsyncLineErrorAnalyzer\n\nasync def analyze_errors():\n    analyzer = AsyncLineErrorAnalyzer()\n\n    # \u5358\u4e00\u30a8\u30e9\u30fc\u306e\u975e\u540c\u671f\u5206\u6790\n    result = await analyzer.analyze(\"(401) Authentication failed\")\n\n    # \u8907\u6570\u30a8\u30e9\u30fc\u306e\u4e00\u62ec\u5206\u6790\uff08\u30d0\u30c3\u30c1\u51e6\u7406\uff09\n    error_messages = [\n        \"(401) Invalid channel access token\",\n        \"(429) Rate limit exceeded\",\n        \"(400) Bad Request\"\n    ]\n    results = await analyzer.analyze_batch(error_messages, batch_size=10)\n\n    for result in results:\n        print(f\"\u30a8\u30e9\u30fc: {result.category.value} - {result.recommended_action}\")\n\nasyncio.run(analyze_errors())\n```\n\n## \ud83d\udcda \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\n\n### \u8a73\u7d30\u30ac\u30a4\u30c9\n\n- **[\ud83d\udcd6 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30ac\u30a4\u30c9](docs/installation.md)** - \u8a73\u7d30\u306a\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u624b\u9806\n- **[\ud83d\ude80 \u30af\u30a4\u30c3\u30af\u30b9\u30bf\u30fc\u30c8](docs/quickstart.md)** - \u3059\u3050\u306b\u59cb\u3081\u3089\u308c\u308b\u30ac\u30a4\u30c9\n- **[\ud83c\udfaf \u4f7f\u7528\u4f8b\u96c6](docs/examples/)** - \u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306e\u6d3b\u7528\u4f8b\n- **[\ud83d\udd27 \u7d71\u5408\u30ac\u30a4\u30c9](docs/integration/)** - FastAPI\u3001Flask \u3068\u306e\u7d71\u5408\n- **[\ud83d\udc1b \u30a8\u30e9\u30fc\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9](docs/errors/)** - \u5168\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u8a73\u7d30\u3068\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\n\n### \ud83d\udcbb \u5b9f\u88c5\u4f8b\n\n\u672c\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306f\u3001\u5b9f\u969b\u306e LINE Bot \u958b\u767a\u3067\u4f7f\u7528\u3067\u304d\u308b\u5b9f\u88c5\u4f8b\u3092\u542b\u3093\u3067\u3044\u307e\u3059\uff1a\n\n- **[\ud83d\udcc1 Examples Collection](examples/)** - \u5b9f\u7528\u7684\u306a LINE Bot \u5b9f\u88c5\u4f8b\n  - **`simple_usage.py`** - \u57fa\u672c\u7684\u306a\u4f7f\u7528\u65b9\u6cd5\u306e\u30c7\u30e2\n  - **`flask_echo_bot.py`** - Flask \u3092\u4f7f\u7528\u3057\u305f\u30a8\u30b3\u30fc Bot\uff08\u30a8\u30e9\u30fc\u51e6\u7406\u4ed8\u304d\uff09\n  - **`fastapi_echo_bot.py`** - FastAPI \u3092\u4f7f\u7528\u3057\u305f\u975e\u540c\u671f\u30a8\u30b3\u30fc Bot\n  - **`aiohttp_echo_bot.py`** - aiohttp \u3092\u4f7f\u7528\u3057\u305f\u30d5\u30eb\u975e\u540c\u671f\u5b9f\u88c5\n\n\u3053\u308c\u3089\u306e\u4f8b\u306f LINE Bot SDK \u306e\u516c\u5f0f\u30b9\u30bf\u30a4\u30eb\u306b\u6e96\u62e0\u3057\u3001\u30b3\u30d4\u30fc&\u30da\u30fc\u30b9\u30c8\u3067\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u8a2d\u8a08\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n\n\u8a73\u7d30\u306f [\ud83d\udcd6 Examples Guide](examples/README.md) \u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\n\n## \u4e3b\u8981\u30a8\u30e9\u30fc\u30ab\u30c6\u30b4\u30ea\n\n| \u30ab\u30c6\u30b4\u30ea              | \u8aac\u660e               | \u4f8b                   |\n| --------------------- | ------------------ | -------------------- |\n| `AUTH_ERROR`          | \u8a8d\u8a3c\u30a8\u30e9\u30fc         | \u7121\u52b9\u306a\u30c8\u30fc\u30af\u30f3       |\n| `RATE_LIMIT`          | API \u547c\u3073\u51fa\u3057\u5236\u9650   | 429 \u30a8\u30e9\u30fc           |\n| `INVALID_REPLY_TOKEN` | \u7121\u52b9\u306a\u8fd4\u4fe1\u30c8\u30fc\u30af\u30f3 | \u671f\u9650\u5207\u308c\u30c8\u30fc\u30af\u30f3     |\n| `USER_NOT_FOUND`      | \u30e6\u30fc\u30b6\u30fc\u672a\u767a\u898b     | \u524a\u9664\u3055\u308c\u305f\u30a2\u30ab\u30a6\u30f3\u30c8 |\n| `SERVER_ERROR`        | \u30b5\u30fc\u30d0\u30fc\u30a8\u30e9\u30fc     | 5xx \u7cfb\u30a8\u30e9\u30fc         |\n\n\u8a73\u7d30\u306a\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u5bfe\u5fdc\u8868\u306f [\ud83d\udcd6 \u30a8\u30e9\u30fc\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9](docs/errors/line_api_codes.md) \u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\n\n## \ud83d\udd27 \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u7d71\u5408\n\n### FastAPI \u3068\u306e\u7d71\u5408\u4f8b\n\n```python\nfrom fastapi import FastAPI\nfrom fastapi.responses import JSONResponse\nfrom linebot.v3.messaging.exceptions import ApiException\nfrom linebot_error_analyzer import LineErrorAnalyzer\n\napp = FastAPI()\nanalyzer = LineErrorAnalyzer()\n\n@app.exception_handler(ApiException)\nasync def line_api_exception_handler(request, exc):\n    error_info = analyzer.analyze(exc)\n    return JSONResponse(\n        status_code=error_info.status_code,\n        content={\n            \"error\": error_info.category.value,\n            \"message\": error_info.message,\n            \"action\": error_info.recommended_action,\n            \"retryable\": error_info.is_retryable\n        }\n    )\n```\n\n## \u30c6\u30b9\u30c8\u5b9f\u884c\n\n```bash\n# \u57fa\u672c\u30c6\u30b9\u30c8\u5b9f\u884c\npython -m pytest tests/ -v\n\n# \u30c6\u30b9\u30c8\u7528\u4f9d\u5b58\u95a2\u4fc2\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\npip install pytest pytest-asyncio\n```\n\n## \u30e9\u30a4\u30bb\u30f3\u30b9\n\nMIT License\n\n## \u514d\u8cac\u4e8b\u9805\n\n\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f**\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u88fd**\u3067\u3059\u3002LINE \u682a\u5f0f\u4f1a\u793e\u3068\u306f\u95a2\u4fc2\u3042\u308a\u307e\u305b\u3093\u3002\n\n## \u53c2\u8003\u30ea\u30f3\u30af\n\n- [LINE Messaging API \u30ea\u30d5\u30a1\u30ec\u30f3\u30b9](https://developers.line.biz/ja/reference/messaging-api/)\n- [LINE Bot SDK for Python](https://github.com/line/linebot-sdk-python)\n- [LINE Developers](https://developers.line.biz/ja/)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "LINE Bot SDK \u306e\u30a8\u30e9\u30fc\u3092\u81ea\u52d5\u5206\u6790\u30fb\u8a3a\u65ad\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea",
    "version": "3.0.1",
    "project_urls": {
        "Bug Reports": "https://github.com/raiton-boo/linebot-error-analyzer/issues",
        "Changelog": "https://github.com/raiton-boo/linebot-error-analyzer/releases",
        "Documentation": "https://github.com/raiton-boo/linebot-error-analyzer/tree/main/docs",
        "Homepage": "https://github.com/raiton-boo/linebot-error-analyzer",
        "Source": "https://github.com/raiton-boo/linebot-error-analyzer"
    },
    "split_keywords": [
        "linebot",
        " bot",
        " error",
        " analyzer",
        " messaging-api",
        " webhook",
        " diagnostics",
        " line",
        " chatbot"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f75405315e864d93e359a4c999b30eb8130c08d66aa712a26c5e2a4ec0849695",
                "md5": "abe1f9a9ee2d6f07aee72e5ff878bc8f",
                "sha256": "891b850a679cd05abc1bd8658a9e323d76a91a0f2cecdd16d35601299e5e938b"
            },
            "downloads": -1,
            "filename": "linebot_error_analyzer-3.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "abe1f9a9ee2d6f07aee72e5ff878bc8f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 31915,
            "upload_time": "2025-08-17T17:20:33",
            "upload_time_iso_8601": "2025-08-17T17:20:33.473809Z",
            "url": "https://files.pythonhosted.org/packages/f7/54/05315e864d93e359a4c999b30eb8130c08d66aa712a26c5e2a4ec0849695/linebot_error_analyzer-3.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "12b12a7c333f7b04b089cc9515f29edab996987420d5cd3eb88e9b5632c57abc",
                "md5": "8af79fb15c8fc955315bdd38d64f95eb",
                "sha256": "ac7fc5157209b4b141b22a8d20d3d971e8b7a568ea71ed22198c611c3ac86483"
            },
            "downloads": -1,
            "filename": "linebot_error_analyzer-3.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8af79fb15c8fc955315bdd38d64f95eb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 28043,
            "upload_time": "2025-08-17T17:20:34",
            "upload_time_iso_8601": "2025-08-17T17:20:34.545039Z",
            "url": "https://files.pythonhosted.org/packages/12/b1/2a7c333f7b04b089cc9515f29edab996987420d5cd3eb88e9b5632c57abc/linebot_error_analyzer-3.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-17 17:20:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "raiton-boo",
    "github_project": "linebot-error-analyzer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "8.0.0"
                ]
            ]
        },
        {
            "name": "pytest-asyncio",
            "specs": [
                [
                    ">=",
                    "0.23.0"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "psutil",
            "specs": [
                [
                    ">=",
                    "5.9.0"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "black",
            "specs": [
                [
                    ">=",
                    "24.0.0"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "mypy",
            "specs": [
                [
                    ">=",
                    "1.8.0"
                ]
            ]
        },
        {
            "name": "sphinx",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "sphinx-rtd-theme",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        }
    ],
    "lcname": "linebot-error-analyzer"
}
        
Elapsed time: 1.45729s