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.0.tar.gz (49.6 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.0-py3-none-any.whl (70.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lush_wecom-0.1.0.tar.gz
  • Upload date:
  • Size: 49.6 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.0.tar.gz
Algorithm Hash digest
SHA256 d3bf48680bb4d287617568e93a44e6eceb3015573209374018496a1a080abc1b
MD5 7b195adc32187b34b8905e1c0518aea2
BLAKE2b-256 484f06b744a52592311f4f00bb182d2069218cde5ca99ef101913f2e26b81d0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lush_wecom-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 70.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6941f560d542effcd62a1988fd717f96e1ac0e2870d7a108b843971591ae8001
MD5 f54a8e7468a3de38eed1a82b21b27d20
BLAKE2b-256 77621ddab29d95cf33e3b39012d0e80b7b485ec56637f9395dbc61c08f0ea0e9

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