ECAPI SDK for Python
Project description
ecapi-sdk (Python)
ECAPI 的 Python SDK,封装了常用接口,并内置两种鉴权方式:
X-API-Key(IAM API Key)X-App-Session-Token(App Session Token)
安装
pip install ecapi-sdk
快速开始
from ecapi_sdk import ECAPIClient
client = ECAPIClient(
base_url="https://your-ecapi-host",
auth={"type": "apiKey", "apiKey": "ec_xxx"},
)
me = client.user.get_me()
player = client.player.get_info({"name": "player123"})
切换为 App Session Token:
client.set_app_session_token("your_app_session_token")
客户端能力
- 统一请求入口:
client.request(method, path, ...) - 默认超时:15 秒(
timeout_seconds可覆盖) - 支持 per-request 覆盖鉴权:
auth=... - 非 2xx 响应抛出
ECAPIError(包含status、payload、url)
API 覆盖
SDK 已封装主要高频接口;其余接口可用
client.request(...)直调。
用户
client.user.get_me()→GET /user/meclient.user.login_by_password(payload)→POST /user/authclient.user.login_by_oauth2(payload)→POST /user/oauth2client.user.refresh_token(payload)→POST /user/refreshclient.user.get_openid()→GET /user/openidclient.user.list_all()→GET /user/allclient.user.update_permissions(payload)→PUT /user/permissionsclient.user.get_by_id(id)→GET /user/:id
玩家
client.player.get_info()/search_ecid()/get_user_data()/query_netease()client.player.set_rank_level(payload)/clear_respack_cache()client.player.get_wallet()/list_gaming_tags()/operate_gaming_tag(payload)client.player.get_last_played()/get_stage_record()client.player.get_headicon()/get_skin()(返回bytes)client.player.batch_netease_nicknames(payload)client.player.get_binding()/reset_binding(payload)/update_binding(payload)client.player.update_user_data(nick, payload)client.player.update_password(ecid, payload)/get_password_hash(ecid)
玩家子模块
client.player.score.*→/player/score*client.player.tasks.*→/player/:ecid/tasks*client.player.merchandise.*→/player/:ecid/merchandise*client.player.year_summary.*→/player/year-summary/*client.player.vote.process_rewards()→GET /player/vote
管理与处罚
client.admin.*→/admin/*client.punish.*→/punish/*client.ban.*→/ban/*client.permission.*→/permission
日志与审计
client.log.*→/log/*client.audit.*→/audit/*
配置与内容
client.stage.*(含stage.logs.*)→/stage/*client.item.get_commodity()→/item/commodityclient.cfglang.*→/cfglang*client.globalkv.*→/globalkv*client.broadcast.*→/broadcast*client.pull_config.pull()→/pull-config
运营与系统
client.order.*→/order/*client.count.*→/count/*client.servers.*→/servers*client.lobby.list()→/lobby/listclient.easechat.*→/easechat/*client.monitor.spam_detector.*→/monitor/spam-detector/*client.system.get_health()→/health
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ecapi_sdk-0.1.0.tar.gz
(8.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ecapi_sdk-0.1.0.tar.gz.
File metadata
- Download URL: ecapi_sdk-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d43506e42c8f9cd18e197d45ba21f3f5b12ebce10acda20983df4c032bab9cb5
|
|
| MD5 |
57dcefa3b6a45fb6b5688ade5e4020af
|
|
| BLAKE2b-256 |
1bfc43f351b3a6c700ea41921ed411cfbdbc2100d829efc2df03e6a458970cb4
|
File details
Details for the file ecapi_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ecapi_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31c3775c1363809346f83a824360dc69b3e6aa8981db0221159144e62055e583
|
|
| MD5 |
543a50a6e7d16731addfe2c27dce344f
|
|
| BLAKE2b-256 |
46d6b8affa65add3b56b333bfdbf3d085db9f6001af09189d19761a6bdcd3978
|