snowland-qyweixin-python
Description
Unofficial open-source SDK for WeCom (Enterprise WeChat), built on top of snowland-http.
This SDK provides a unified, rate-limited HTTP transport layer via snowland-http.
Every client exposes both synchronous and asynchronous (asyncio) APIs, backed by
requests / httpx respectively.
Installation
Core dependencies (no concrete HTTP library — only the snowland-http transport abstraction):
pip install -r requirements.txt
HTTP backends are all optional: you can import and use the SDK without any backend installed, but calling the corresponding sync/async request methods will raise a clear message at runtime. Install only one of them as needed (do not install all at once):
pip install snowland-qyweixin[requests] # sync only
pip install snowland-qyweixin[httpx] # sync + async (recommended, one library covers both)
pip install snowland-qyweixin[aiohttp] # async only
# or install a single one manually:
pip install requests / httpx / aiohttp
Quick Start
Synchronous client:
from qywechat import MessageClient
client = MessageClient(corpid="xxx", corpsecret="yyy", agentid=1000001)
client.send_text("hello", touser=["zhangsan", "lisi"])
Asynchronous client:
import asyncio
from qywechat import MessageClient
async def main():
client = MessageClient(corpid="xxx", corpsecret="yyy", agentid=1000001)
await client.send_text_async("hello", touser="zhangsan")
asyncio.run(main())
Group robot (Webhook):
from qywechat import Robot
robot = Robot("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxx")
robot.send_markdown("**hello**")
Modules
Each client class provides both synchronous and asynchronous methods: the synchronous
method uses the feature name (e.g. send_text), and the corresponding async method appends
the _async suffix (e.g. send_text_async).
| Module | Client Class | Features |
|---|---|---|
message |
MessageClient |
Application messages (text/markdown/image/voice/video/file/textcard/news), group chat management (create/update/get) and group chat message sending |
oa |
OAClient |
Approval: get approval number list, approval detail, submit approval application |
contact |
ContactClient |
Contacts: CRUD for members and departments |
external_contact |
ExternalContactClient |
External contact (customer acquisition): follow-user list, customer list, customer detail |
robot |
Robot |
Group robot: text/markdown/image/news/file messages and media upload |
Tests
python -m unittest discover -s qywechat/tests -p "test_*.py"
Notes
BaseClientholds both a synchronous and an asynchronousHttpClient, andaccess_tokenis reused within its validity period.- Synchronous methods only require any one synchronous library (candidates:
requests,httpx); async methods only require any one asynchronous library (candidates:httpx,aiohttp). A missing library raises a clear message only when the corresponding method is actually used. - Global token-bucket rate limiting can be enabled via
rate_limit=RateLimitConfig(...).
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 snowland_qyweixin-0.1.0.tar.gz.
File metadata
- Download URL: snowland_qyweixin-0.1.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f804ca3ea19200a1212c2b471aa2c9bf3c4bc872a283498710c34cf304d61cc8
|
|
| MD5 |
78308f55610a33c8e66bd2974e6de9d9
|
|
| BLAKE2b-256 |
d7eeeb8c7dfab1b1a5b09c058ab804887cec4f15590a8206b8c9f00419ca91cd
|
File details
Details for the file snowland_qyweixin-0.1.0-py3-none-any.whl.
File metadata
- Download URL: snowland_qyweixin-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
766ad7e335d66959a51a8b7ecd9d08e65664b2401caa4721fdede2fdba7583e0
|
|
| MD5 |
138dbe445600ce37909eb3b44432a649
|
|
| BLAKE2b-256 |
a5e23191402b5b070c3f06576af5a4c02d77d0264434f5e80f24211b4ecd9645
|