Background
The official SDK pauses for 1 hour when receiving errcode -14 (session expired). Our current implementation raises SessionExpiredError and the dispatcher stops immediately.
Current behavior
_protocol.py: errcode == -14 → raises SessionExpiredError
client.py _poll_loop: catches SessionExpiredError → break (dispatcher stops)
- User must manually re-login
Questions to investigate
- Does the session auto-recover after the 1-hour pause, or is re-login always required?
- Is the 1-hour pause a server-imposed cooldown (will immediate re-login fail)?
- How frequently does session expiry occur in normal usage?
- Does the server return any additional fields with errcode -14 (retry hints, TTL)?
Phase 1 (logging)
- Enhanced logging on
SessionExpiredError: full error details, timestamp
- Log complete response body when
errcode == -14
Phase 2 (implementation, based on findings)
- If auto-recovery: sleep + retry with configurable duration
- If re-login required: keep break + provide callback/event hook
- Consider exposing a
on_session_expired event
Files
src/weilink/_protocol.py
src/weilink/client.py
Background
The official SDK pauses for 1 hour when receiving
errcode -14(session expired). Our current implementation raisesSessionExpiredErrorand the dispatcher stops immediately.Current behavior
_protocol.py:errcode == -14→ raisesSessionExpiredErrorclient.py_poll_loop: catchesSessionExpiredError→break(dispatcher stops)Questions to investigate
Phase 1 (logging)
SessionExpiredError: full error details, timestamperrcode == -14Phase 2 (implementation, based on findings)
on_session_expiredeventFiles
src/weilink/_protocol.pysrc/weilink/client.py