Files
LangBot/src/langbot/libs/wechatpad_api
Junyan Chin 88132dff8a perf: reduce memory usage by ~200MB+ at startup (#2013)
* perf: reduce memory usage by ~200MB+ at startup

Two key optimizations:

1. Use importlib.util.find_spec() instead of __import__() in dependency
   checking. find_spec() only locates modules without executing them,
   avoiding loading all 36 dependencies (~222MB) into memory at startup.

2. Introduce shared aiohttp.ClientSession via httpclient module.
   Previously, every HTTP request created a new ClientSession, which
   creates a new TCPConnector and SSL context, loading system root
   certificates each time (~270MB total allocations observed via memray).
   Now all HTTP client code reuses shared sessions.

   - satori.py and coze_server_api/client.py are left unchanged as they
     create one session per adapter lifecycle (not per-request).

Profiling data (memray):
- Peak memory: 403MB
- SSL context creation: 270MB / 6.7M allocations (67% of total)
- Dependency import: 222MB (55% of peak)
- Expected reduction: 150-350MB at startup

* fix: remove unused aiohttp imports (ruff F401)

* style: ruff format
2026-02-27 20:09:03 +08:00
..

wechatpad-python

此项目时准备对接wechatpadpro 的pythonsdk

未完工接口

  • 关于好友的接口

  • 关于群管理的接口

  • 关于下载的接口

  • 关于用户的部分接口

  • 关于消息的部分接口

  • 关于支付的

  • 关于朋友圈的

  • 关于标签的

  • 关于收藏的

  • 暂时只写了一部分接口

已完工接口

  1. 获取普通token
  2. 登录二维码(只是返回数据,暂时还未打印二维码)
  3. 获取登录状态
  4. 唤醒登录
  5. 退出登录
  6. 获取用户信息
  7. 获取用户二维码
  8. 上传用户头像
  9. 获取设备信息
  10. 发送文本消息
  11. 发送图片消息
  12. 发送语音消息
  13. 发送app消息
  14. 发送emoji消息
  15. 发送名片消息
  16. 撤回消息