ME Frp Python SDK
ME Frp 5.0 的官方 Python SDK,支持同步和异步两种调用模式。
安装
推荐使用 uv 进行安装和管理。
仅同步支持 (requests)
uv add MEFrpLib --optional sync
# 或者使用 pip
pip install MEFrpLib[sync]
仅异步支持 (aiohttp)
uv add MEFrpLib --optional async
# 或者使用 pip
pip install MEFrpLib[async]
全部安装
uv add MEFrpLib --optional all
# 或者使用 pip
pip install MEFrpLib[sync,async]
快速开始
同步模式
from MEFrpLib import MEFrpClient
# 初始化客户端
client = MEFrpClient()
# 登录
client.login("username", "password", "captcha_token")
# 获取用户信息
user_info = client.get_user_info()
print(f"欢迎回来, {user_info.username}! 剩余流量: {user_info.traffic} MB")
# 获取隧道列表
proxies_resp = client.get_proxy_list()
for proxy in proxies_resp.proxies:
print(f"隧道: {proxy.proxyName} -> {proxy.domain}:{proxy.remotePort}")
异步模式
import asyncio
from MEFrpLib import AsyncMEFrpClient
async def main():
# 使用上下文管理器自动管理 session
async with AsyncMEFrpClient() as client:
# 登录
await client.login("username", "password", "captcha_token")
# 获取用户信息
user_info = await client.get_user_info()
print(f"用户: {user_info.username}")
# 获取节点列表
nodes = await client.get_node_list()
for node in nodes:
print(f"节点: {node.name} ({node.region})")
if __name__ == "__main__":
asyncio.run(main())
异常处理
SDK 定义了以下异常:
MEFrpError: 所有 SDK 异常的基类APIError: 当 API 返回非 200 状态码或业务错误时抛出AuthError: 身份验证失败(如 Token 无效)时抛出NetworkError: 网络请求失败或超时时抛出
from MEFrpLib import MEFrpClient, APIError
client = MEFrpClient(token="your_token")
try:
info = client.get_user_info()
except APIError as e:
print(f"API 错误: {e.message} (代码: {e.code})")
开发指南
如果您想参与开发、构建或对代码进行格式化,请确保已安装 uv。
初始化环境
# 克隆仓库后
uv sync --all-extras
代码检查与格式化
# 检查并自动修复
uvx ruff check . --fix
# 格式化代码
uvx ruff format .
构建与发布
项目使用 uv 进行构建和发布。
-
构建分发包:
uv build构建完成后,
dist/目录下会生成.tar.gz(sdist) 和.whl(wheel) 文件。 -
发布到 PyPI(需要权限):
uv publish
提示:GitHub Actions 已配置为在发布新 Release 时自动使用
uv构建并发布到 PyPI。
开源协议
AGPL v3
Metadata
Release files for MEFrpLib 3.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mefrplib-3.3.0.tar.gz | 150.3 kB | Without provenance | Details for mefrplib-3.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mefrplib-3.3.0-py3-none-any.whl | Python 3 | none | any | Details for mefrplib-3.3.0-py3-none-any.whl |
Total release size: 173.2 kB
Release files / mefrplib-3.3.0.tar.gz
| Download URL | mefrplib-3.3.0.tar.gz |
|---|---|
| Size | 150.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e1b100dfd59638958c83cb7c9afaa8419c1e5d9378b2245922ce015a01b48b3
|
|
BLAKE2b-256 checksum How to use checksums |
f3abbf6846b8dd016c6a3ac81d4db96e71002d7423fc6b8472ea5db9b6acb606
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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}
|
Release files / mefrplib-3.3.0-py3-none-any.whl
| Download URL | mefrplib-3.3.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f07d9898c22b0e4325beeedbf2ac5223f3b9ee7e03afc82f95b921dbcfba3d5
|
|
BLAKE2b-256 checksum How to use checksums |
5e1e678f56dce3bd3c172561904f72e2e670dd4b5872b3d26fd54548ecf411c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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}
|
Security for MEFrpLib 3.3.0
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.