Unofficial Python SDK for the iLink-compatible Weixin bot protocol.
Project description
wechat-link
Unofficial Python SDK for iLink-compatible Weixin Bot integration.
wechat-link 是一个面向 iLink-compatible Weixin Bot 集成的 Python SDK,重点放在协议层、媒体链路和一个可选的轻量 Relay 上,而不是去做一个大而全的 Bot 平台。
What it currently provides
- QR login primitives:
get_bot_qrcode()/get_qrcode_status() - Long polling:
get_updates() - Text messaging:
send_text() - Typing support:
get_config()/send_typing() - Media workflow:
get_upload_url()upload_image()/send_image()upload_file()/send_file()upload_video()/send_video()upload_voice()/send_voice()
- Optional FastAPI relay layer
Installation
pip install wechat-link
Relay extras:
pip install "wechat-link[relay]"
Minimal usage example
from wechat_link import WeChatLinkClient
client = WeChatLinkClient(bot_token="your-bot-token")
updates = client.get_updates(cursor="")
print("next_cursor:", updates.next_cursor)
print("messages:", len(updates.messages))
client.close()
Quick example
import time
from wechat_link import FileCursorStore, WeChatLinkClient
client = WeChatLinkClient(bot_token="your-bot-token")
store = FileCursorStore(".state/get_updates_buf.json")
cursor = store.load() or ""
try:
while True:
updates = client.get_updates(cursor=cursor)
if updates.next_cursor:
cursor = updates.next_cursor
store.save(cursor)
for message in updates.messages:
text = message.text().strip()
if not text or not message.from_user_id or not message.context_token:
continue
client.send_text(
to_user_id=message.from_user_id,
text=f"echo: {text}",
context_token=message.context_token,
)
time.sleep(1)
finally:
client.close()
Project links
- Repository: https://github.com/syusama/wechat-link
- Issues: https://github.com/syusama/wechat-link/issues
- Chinese README: https://github.com/syusama/wechat-link/blob/main/README.md
- English README: https://github.com/syusama/wechat-link/blob/main/README.en.md
- Japanese README: https://github.com/syusama/wechat-link/blob/main/README.ja.md
Notes
- This is an unofficial project.
- It should not be described as a Tencent official SDK or official platform replacement.
- The PyPI page keeps the package overview concise; the full documentation and examples live in the GitHub repository.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wechat_link-0.1.2.tar.gz.
File metadata
- Download URL: wechat_link-0.1.2.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87cb331f1322799b4b6e402303f57170abd58bae27449460264cfa9f04c4c7c4
|
|
| MD5 |
8a59fef635d7cbee4609f711243f53e9
|
|
| BLAKE2b-256 |
efb1c9ba6ac561b1e317c99e2f21ef040f9751224ead44bbd9c0ff23cebd63a2
|
Provenance
The following attestation bundles were made for wechat_link-0.1.2.tar.gz:
Publisher:
publish.yml on syusama/wechat-link
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wechat_link-0.1.2.tar.gz -
Subject digest:
87cb331f1322799b4b6e402303f57170abd58bae27449460264cfa9f04c4c7c4 - Sigstore transparency entry: 1161443115
- Sigstore integration time:
-
Permalink:
syusama/wechat-link@516d2869840dc7e39128843544c6f50ce54e9bf4 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/syusama
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@516d2869840dc7e39128843544c6f50ce54e9bf4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wechat_link-0.1.2-py3-none-any.whl.
File metadata
- Download URL: wechat_link-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
689a22d99d20a0599334d07630d5f682c9641fdf69a5aca75c945df13fbecee8
|
|
| MD5 |
81950fc1e616dae7e54a5ad6460ead6e
|
|
| BLAKE2b-256 |
419a6024c3721c1cc6298731ab62a65639bb4bad564c11b122c6b05d4e57c11f
|
Provenance
The following attestation bundles were made for wechat_link-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on syusama/wechat-link
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wechat_link-0.1.2-py3-none-any.whl -
Subject digest:
689a22d99d20a0599334d07630d5f682c9641fdf69a5aca75c945df13fbecee8 - Sigstore transparency entry: 1161443180
- Sigstore integration time:
-
Permalink:
syusama/wechat-link@516d2869840dc7e39128843544c6f50ce54e9bf4 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/syusama
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@516d2869840dc7e39128843544c6f50ce54e9bf4 -
Trigger Event:
push
-
Statement type: