Metadata-Version: 2.4
Name: wechatpay-python
Version: 0.0.1
Summary: A Python SDK foundation for WeChat APIs
Project-URL: Homepage, https://github.com/tiyee/wechat-py
Project-URL: Repository, https://github.com/tiyee/wechat-py
Project-URL: Issues, https://github.com/tiyee/wechat-py/issues
Author: TiyeeJiang
License: MIT License
        
        Copyright (c) 2026 TiyeeJiang
        
        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.
License-File: LICENSE
Keywords: api,sdk,wechat,weixin
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx<1,>=0.27
Description-Content-Type: text/markdown

# wechat-py

微信 API 的 Python SDK 基础框架，使用 uv 管理依赖，支持 Python 3.9 及以上版本。

## 安装

发布到 PyPI 后，可以使用以下命令安装：

```bash
uv add wechatpay-python
# 或 pip install wechatpay-python
```

## 开发

```bash
uv sync --group dev
uv run pytest
uv run ruff check .
uv build
```

## 使用

```python
from wechat_py import WeChatAPIError, WeChatClient

try:
    with WeChatClient() as client:
        result = client.request(
            "GET", "/some/api", params={"access_token": "YOUR_ACCESS_TOKEN"}
        )
        print(result)
except WeChatAPIError as exc:
    print(exc.code, exc.message)
```

示例中的路径是占位符，使用时请替换为实际接口。当前框架提供同步 JSON 请求、HTTP 和微信 API 错误处理；业务接口、access token 获取和刷新尚未实现。调用方负责凭证管理，避免将密钥提交到仓库。网络或 HTTP 错误以及非 JSON 对象响应会抛出 `WeChatTransportError`。

可通过 `http_client` 注入已配置的 `httpx.Client`；注入的客户端由调用方负责关闭。默认客户端可通过 `base_url` 和 `timeout` 配置，并由 `WeChatClient` 关闭。

## 发布到 PyPI

构建并发布当前版本：

```bash
uv build
uv publish dist/wechatpay_python-0.0.1.tar.gz dist/wechatpay_python-0.0.1-py3-none-any.whl
```

发布前需具备 PyPI 项目发布权限，并按 uv 提示提供 PyPI API token。请勿将 token 写入项目文件或提交到仓库。
