Metadata-Version: 2.4
Name: py-wecom-toolkit
Version: 3.0.11
Summary: 企业微信 Python 扩展包 - 支持 Webhook 与 Server 端 API
Author-email: 郭磊 <174000902@qq.com>
License: MIT License
        
        Copyright (c) 2024 py-wecom-toolkit
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://gitee.com/guolei19850528/py_wecom_toolkit
Project-URL: Documentation, https://gitee.com/guolei19850528/py_wecom_toolkit#readme
Keywords: wecom,wechat,work,webhook,enterprise
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: cache
Requires-Dist: diskcache>=5.0.0; extra == "cache"
Requires-Dist: redis>=5.0.0; extra == "cache"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: python-dotenv>=1.0.0; extra == "dev"
Dynamic: license-file

# py-wecom-toolkit

[![PyPI version](https://img.shields.io/pypi/v/py-wecom-toolkit.svg?logo=pypi)](https://pypi.org/project/py-wecom-toolkit/)
[![Python Version](https://img.shields.io/pypi/pyversions/py-wecom-toolkit.svg?logo=python)](https://www.python.org/)

[文档](https://gitee.com/guolei19850528/py_wecom_toolkit) | [API 参考](https://developer.work.weixin.qq.com/document/path/91770)

**企业微信 Python 扩展包，支持 Webhook（群机器人）与 Server 端 API。**

py-wecom-toolkit 让你极其简单地与企业微信 API 交互。无需手动拼接 URL，无需手动构建 JSON 负载，自动缓存 access_token，支持同步和异步客户端。

## 安装

```bash
uv pip install py-wecom-toolkit

# 或使用 pip
pip install py-wecom-toolkit
```

## 快速开始

```python
from py_wecom_toolkit.webhook.client import WeComWebhookClient

with WeComWebhookClient(key="你的webhook_key") as client:
    resp = client.send_text("Hello, World!")
    print(f"发送结果: {resp.errmsg}")
```

```python
import asyncio
from py_wecom_toolkit.webhook.client import AsyncWeComWebhookClient

async def main():
    async with AsyncWeComWebhookClient(key="你的webhook_key") as client:
        resp = await client.send_text("Hello, World!")
        print(f"发送结果: {resp.errmsg}")

asyncio.run(main())
```

```python
from py_wecom_toolkit.server.client import WeComServerClient

client = WeComServerClient(
    corpid="你的CorpID",
    corpsecret="你的CorpSecret",
    agentid="你的AgentID",
)

token = client.get_access_token()
print(f"access_token: {token}")

resp = client.send_text(content="Hello, WeCom!", touser="Guolei")
print(f"发送结果: {resp.errmsg}")

client.close()
```

## 许可证

[MIT](LICENSE)
