Skip to main content

OkLine — an unofficial, high-level Python client / SDK for the LINE Chrome messaging API (CHROMEOS 3.7.2): send messages, QR & email login, X-Hmac signing, and full response recording.

Project description

OkLine

A high-level Python client / SDK for the LINE Chrome messaging API.

Python License: MIT Tests Endpoints

OkLine reproduces the API of the official LINE Chrome extension (CHROMEOS 3.7.2) — send and receive messages, log in by QR or e‑mail, and automate your own account from Python. The protocol is reproduced faithfully, including the mandatory X-Hmac signature (computed by LINE's real ltsm.wasm), so requests are byte‑for‑byte what the real client sends.

from okline import OkLine

api = OkLine(access_token="…", refresh_token="…")
print(api.get_profile())
api.send_text("u0123456789abcdef0123456789abcdef", "hello from python")

Features

  • All 77 endpoints — typed methods, or call any of them generically.
  • QR & e‑mail login — QR rendered as ASCII right in your terminal.
  • X-Hmac signing — handled automatically via the bundled WASM module.
  • Bot framework@bot.on_message, typed models, session persistence.
  • Response recording — capture, redact and export every request/response.
  • CLIpython -m okline … to call any endpoint from the shell.

Install

Prerequisites

  • Python 3.9+
  • Node.js 18+ on your PATH — required to compute the mandatory X-Hmac request signature (the real ltsm.wasm runs through a tiny Node bridge; details). Check with node --version.

Install from source (recommended — installs OkLine and its dependencies):

git clone https://github.com/NiceDayZc/okline.git
cd okline
pip install -e .          # installs the `okline` package + requests + cryptography
pip install qrcode        # optional: render the QR-login code in your terminal

Verify it works:

python -m okline version

Not on PyPI yet. Once published you'll be able to pip install okline — until then use the source install above.

First login (do this once; the session is then reusable):

python -m okline qr-login --save tokens.json     # scan the QR with the LINE app
python -m okline profile --tokens-file tokens.json

Quick start

from okline import OkLine, Bot

# log in once, reuse the session forever
api = OkLine()
api.auth.qr_login(on_qr=print)        # scan the QR with your phone
api.save_tokens("session.json")

# next time
api = OkLine.from_tokens_file("session.json")
api.send_text("c…group…mid", "hi from python")

# a 3-line echo bot
bot = Bot(api)
bot.on_message(lambda ctx: ctx.reply(f"you said: {ctx.text}"))
bot.run()

From the shell:

python -m okline qr-login --save tokens.json
python -m okline call Talk.TalkService.getProfile "[2]" --tokens-file tokens.json
python -m okline send <mid> "hello" --tokens-file tokens.json

Documentation

Guide
Getting started install, first call, the OkLine object
Authentication token reuse, e‑mail (RSA), QR login, refresh
Sending messages text, stickers, location, media, reactions
Receiving events the SSE stream and a simple bot
Building bots & helpers bot framework, typed models, sessions
Recording paste / export every response
CLI every python -m okline command
Architecture the protocol, X-Hmac, module map
Endpoint reference all 77 endpoints with their fields
Troubleshooting · Contributing

Disclaimer

OkLine is unofficial and not affiliated with LINE Corporation. Use it only with your own account and in compliance with LINE's Terms of Service. Treat tokens like passwords — see SECURITY.md.

License

MIT

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

okline-2.4.0.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

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

okline-2.4.0-py3-none-any.whl (2.3 MB view details)

Uploaded Python 3

File details

Details for the file okline-2.4.0.tar.gz.

File metadata

  • Download URL: okline-2.4.0.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for okline-2.4.0.tar.gz
Algorithm Hash digest
SHA256 4375a5341cf5ae02d2a358f49a713626a5d01e4fe678ad833b226475f4628165
MD5 b1d14405fd0dd8dda55fd9a73517718b
BLAKE2b-256 1635803dfc2bf09971bf4bd481cee80eda6b0279f93a8194a7d4a4a6fab2d560

See more details on using hashes here.

File details

Details for the file okline-2.4.0-py3-none-any.whl.

File metadata

  • Download URL: okline-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for okline-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 315628bf662e11288043541f4150d40c08f16cb0a55e3d9d84b1cf009d5c6817
MD5 fc65f03acaf3b2c3203164383c2c8c59
BLAKE2b-256 d2e2a44ba471f8669c024334be18b93f3e4cac320cb1253315982e701b0d2f48

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