Skip to content

0.2.0

Choose a tag to compare

@molanp molanp released this 01 Nov 14:29
· 3 commits to main since this release
a760869

在 MCSM 10.22.1 完成测试

⚠️ Breaking Changes

  • 全面异步化: 底层从 requests 迁移到 httpx,所有 API 方法改为 async def。需要 await 调用
  • Request 实例化: Request 不再使用类变量,每个 MCSMAPI 实例拥有独立的连接和认证状态,支持多实例并行使用
  • Python 版本要求: 最低 Python 3.10
  • 部分接口重命名/移除: 移除前端已弃用的接口,清理孤立模型

✨ New Features

  • 101 个端点全覆盖: 10 个模块(Overview / User / Instance / Daemon / File / Image / Schedule / Java / Mod / Upgrade),共 101 个 API 方法,全部对齐 MCSManager 10.x 源码
  • 链式操作: 返回的模型对象可直接调用操作方法,如 instance.start() / file.rename() / daemon.link()
  • 支持部分更新: instance.updateConfig()、daemon.update()、overview.update_setting() 等接口支持只传需要修改的字段,不会覆盖未传入的配置
  • 重复登录自动处理: 连续调用 login() 时,自动注销旧 session 再重新登录,避免获取到无效 token "Logined"。
  • async with 和手动管理两种风格
    # async with
    async with MCSMAPI("http://localhost:23333") as mcsm:
        await mcsm.login("admin", "password")
    
    # 手动管理
    mcsm = MCSMAPI("http://localhost:23333")
    await mcsm.login("admin", "password")
    # ...
    await mcsm.close()

🐛 Bug Fixes

  • 修复缺失 X-Requested-With: XMLHttpRequest 请求头导致 403
  • 修复 Instance.delete 使用 data= 而非 json= 导致 500
  • 修复 File.show 返回模型字段与实际接口不匹配导致 ValidationError
  • 修复重复 login() 返回 "Logined" 后后续请求 403
  • 修复多个 MCSMAPI 实例共享类变量导致 URL/token 互相覆盖
  • 修复 FileDownloadConfig.remoteMappings 类型错误

📦 Dependencies

  • httpx >= 0.27.0(替代 requests)
  • pydantic >= 2.0.0, < 3.0.0

📖 Documentation

  • 新增 6 个完整示例:Overview / Instance / File / User / Daemon / Schedule
  • 更新 README 中英文版本

Full Changelog: https://github.com/sokoko-org/mcsmapi/commits/0.2.0