Skip to main content

wechat-py

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

安装

发布到 PyPI 后,可以使用以下命令安装:

uv add wechat-sdk-python
# 或 pip install wechat-sdk-python

开发

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

使用

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

构建并发布当前版本:

uv build
uv publish dist/wechat_sdk_python-0.0.1.tar.gz dist/wechat_sdk_python-0.0.1-py3-none-any.whl

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

Metadata

Release files for wechat-sdk-python 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wechat-sdk-python 0.0.1
File Size Uploaded Provenance Actions
wechat_sdk_python-0.0.1.tar.gz 18.6 kB Without provenance Details for wechat_sdk_python-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wechat-sdk-python 0.0.1
File Interpreter ABI Platform Actions
wechat_sdk_python-0.0.1-py3-none-any.whl Python 3 none any Details for wechat_sdk_python-0.0.1-py3-none-any.whl

Total release size: 23.9 kB

Release files / wechat_sdk_python-0.0.1.tar.gz

Download URL wechat_sdk_python-0.0.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
017a408c36eb988e792da433d2bce378b03805314debdc0b662eea28da42e283
BLAKE2b-256 checksum
How to use checksums
6ed3746e8ecfcb731280545bf65c7941e2294e9cd9b086e7532614caaa868628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wechat_sdk_python-0.0.1-py3-none-any.whl

Download URL wechat_sdk_python-0.0.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
986a14621b78b03f83dcc36cb0cc3846dca2b838c66c23a8b56e791606833529
BLAKE2b-256 checksum
How to use checksums
a508354cd4b573c2815bde0f560aad0a36080c49327368b0179361de268fd40a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for wechat-sdk-python 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page