OkLine
A high-level Python client / SDK for the LINE Chrome messaging API.
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-Hmacsigning — 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.
- CLI —
python -m okline …to call any endpoint from the shell.
Install
pip install okline
The bundled ltsm.wasm (for X-Hmac signing) ships inside the wheel, so that's
all you need from Python. Optionally pip install qrcode to render the QR-login
code in your terminal.
Prerequisites
- Python 3.9+
- Node.js 18+ on your
PATH— required to compute the mandatoryX-Hmacrequest signature (the realltsm.wasmruns through a tiny Node bridge; details). Check withnode --version.
Verify it works:
python -m okline version
Install from source instead
git clone https://github.com/NiceDayZc/okline.git
cd okline
pip install -e . # editable install of the okline package + deps
First login (do this once; the session is then reusable):
okline login # scan the QR with the LINE app — saves tokens.json
Then just run okline for an interactive, menu-driven UI (pick actions by
number), or use any of the ~30 subcommands directly:
okline # interactive menu (soft colours, no setup)
okline whoami
okline send <mid> "hello"
okline contacts --search soda
okline chatlog <chat-mid> # reads and decrypts recent messages
okline -h # full command list
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 — okline login once, then everything reuses the session:
okline login # scan the QR; saves tokens.json
okline send <mid> "hello"
okline call Talk.TalkService.getProfile "[2]"
Documentation
Full docs in docs/:
| Guide | |
|---|---|
| Getting started | install, okline login, the menu, first Python call |
| Authentication | token reuse, e‑mail (RSA), QR login, refresh, logout |
| Sending messages | text, stickers, location, contacts, flex, reactions |
| Media · E2EE | send images/files · encrypt & decrypt (1:1 + group) |
| Receiving events · Bots | the SSE stream · the bot framework |
| Recording | paste / export every response |
| CLI · Cookbook | every okline command · copy‑paste recipes |
| 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
Metadata
Release files for okline 2.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| okline-2.7.0.tar.gz | 2.4 MB | Without provenance | Details for okline-2.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| okline-2.7.0-py3-none-any.whl | Python 3 | none | any | Details for okline-2.7.0-py3-none-any.whl |
Total release size: 4.7 MB
Release files / okline-2.7.0.tar.gz
| Download URL | okline-2.7.0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72e421d727e105d637b7e3e0559abdb0deea5b1c88718ceb9476ca956ab8fc0e
|
|
BLAKE2b-256 checksum How to use checksums |
4f7e7c01627a49912febd83a46dbd5f1b2f48cb65b028a16eda974230d72cc1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Release files / okline-2.7.0-py3-none-any.whl
| Download URL | okline-2.7.0-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
431ba062a418f8f92c529556f7eb5022e9ca261a0e503fbba2336345f8bd1c88
|
|
BLAKE2b-256 checksum How to use checksums |
37ed6317fd9e5370ff5a5a8903292f04a8047d9dc2502ae97a324fa4016d68ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Security for okline 2.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.