Skip to main content

see README.md

Project description

lush-wecom

WeCom(企业微信) 的客户端封装与数据模型. 目标是让你少写一点“拼 URL + 拼 params + 手动处理 errcode”的重复代码.

它提供:

  • 同步/异步两套客户端
  • access_token 管理(可接 Redis 或自定义存储)
  • 统一的异常与重试策略
  • pydantic v2 的请求/响应模型

快速开始

from lush_wecom import WeComClient, WeComTokenManager
from lush_wecom.models.send_app_message_vo import SendAppMessageRequest, TextContent

token_mgr = WeComTokenManager(corpid="YOUR_CORP_ID", corpsecret="YOUR_CORP_SECRET")
client = WeComClient(token_manager=token_mgr)

req = SendAppMessageRequest(
    touser="userid1|userid2",
    agentid=1000002,
    msgtype="text",
    text=TextContent(content="hello"),
)
resp = client.send_app_message(req)

开发

uv sync -p 3.10 --frozen
uv run -p 3.10 pytest

目录结构

src/lush_wecom/
├── __init__.py           # 包导出
├── client/               # 客户端实现
│   ├── __init__.py       # 客户端统一导出
│   ├── _async/           # 异步客户端实现
│   └── _sync/            # 同步客户端实现
├── core/                 # 核心功能
│   ├── base.py           # 基础客户端类
│   ├── const.py          # 常量定义
│   ├── exceptions.py     # 异常定义
│   ├── storage.py        # 存储抽象
│   └── token_mgr.py      # Token管理器
├── models/               # 数据模型
│   ├── common_vo.py      # 通用模型
│   ├── *_vo.py           # 各API专用模型
├── utils/                # 工具函数
│   ├── retry.py          # 重试工具
│   └── oauth.py          # OAuth工具
└── tests/                # 测试代码

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

lush_wecom-0.1.1.tar.gz (46.4 kB view details)

Uploaded Source

Built Distribution

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

lush_wecom-0.1.1-py3-none-any.whl (65.9 kB view details)

Uploaded Python 3

File details

Details for the file lush_wecom-0.1.1.tar.gz.

File metadata

  • Download URL: lush_wecom-0.1.1.tar.gz
  • Upload date:
  • Size: 46.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lush_wecom-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3031d55b4d31880dbc3816c34f94ed11d278a9ebc70d8b720022d5c0fd7cfe38
MD5 5e90f24eedf55a51f664e14c6aec3834
BLAKE2b-256 7dbefb6f49de1add959564006b600dd263140e32b1765b9edeb42b9da6f00a5e

See more details on using hashes here.

File details

Details for the file lush_wecom-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lush_wecom-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 65.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lush_wecom-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2bc87b7624767b405f43a1f0422b1ad3894be0861c3258a5b108356e0e42a605
MD5 9d65db161155a3c40329bcf3bc8b73ab
BLAKE2b-256 218f5e3be61f4e632ab09e4310c7997acfd56ca37f10a4612d48f004817e48ba

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