Skip to main content

LINE Official User API wrapper library for Python

Project description

LINEOALib

LINEOALibは、LINE公式アカウントの管理・チャット・認証・自動化をPythonから簡単に扱えるライブラリです。

特徴

  • Seleniumによる認証・Cookie管理
  • 複数Bot・チャットの取得・送信・監視

インストール

pip install -r requirements.txt

使い方

1. 初回認証(SeleniumによるCookie保存)

from LINELib import LINELib
COOKIE_PATH = os.environ.get("LINEOA_COOKIE_PATH", "lineoa_cookie.json")
lib = LINELib(storage=COOKIE_PATH)  # 初回はSeleniumで手動ログイン
#storageを設定することによりcookieを保存

2. 以降はCookie自動復元

COOKIE_PATH = os.environ.get("LINEOA_COOKIE_PATH", "lineoa_cookie.json")
lib = LINELib(storage=COOKIE_PATH)
#次回からcookieを利用してログイン

3. Bot一覧・チャット一覧取得

bots = lib.bots.ids  # {bot名: botId}
chats = lib.chats.user.ids  # ユーザーchatId一覧

4. メッセージ送信

lib.send_message(user_id, "こんにちは!", bot_id)

5. 画像送信

lib.send_file(chat_id, "sample.png", bot_id)

6. メッセージ監視

lib.listen_messages(bot_id, chat_id, on_message=lambda msg: print(msg))

サンプル

example を参照してください。

クラス構成

  • LINELib ... 全機能統合のメインクラス
  • AuthService ... 認証・Cookie管理
  • ChatService ... チャットAPI
  • LINEOAError ... 例外クラス

ライセンス

MIT License

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

lineoa-4.4.3.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

lineoa-4.4.3-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file lineoa-4.4.3.tar.gz.

File metadata

  • Download URL: lineoa-4.4.3.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lineoa-4.4.3.tar.gz
Algorithm Hash digest
SHA256 b44768be69e62d9bf99b5d78b12bfdb664e66da8c4fdebd6562ed55ab2c328b8
MD5 a169f9d66203b9ce56fe3012a990d578
BLAKE2b-256 9388880998206f91fdde44ef01f081c85f9d78b994d86cac1988e2050b49fda0

See more details on using hashes here.

Provenance

The following attestation bundles were made for lineoa-4.4.3.tar.gz:

Publisher: python-publish.yml on Madoa5561/LINELib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lineoa-4.4.3-py3-none-any.whl.

File metadata

  • Download URL: lineoa-4.4.3-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lineoa-4.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 553b975d8bf197284cbb94f26167cd6707ce9078264b3ab9029ef0a003c3c0e9
MD5 d5ab958e79c816d5b26f31a30094392b
BLAKE2b-256 a26e7129fd9a4d2204354ec9babbb9749f43f92eda9a22ed0873e04b987cb9f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for lineoa-4.4.3-py3-none-any.whl:

Publisher: python-publish.yml on Madoa5561/LINELib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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