Skip to content

Add public accessors for regional host and Tapo token (avoid consumers touching internals) #118

Description

@piekstra

Consumers that restore a session from a stored token (e.g. tplinkcloud-service) currently have to reach into private attributes because there's no public API for two things:

  1. Regional API host — discovered during login() and needed to reconstruct a working manager from a stored token. Consumers read/write manager._kasa_api.host. Proposed: get_api_host() / set_api_host(host) (and the Tapo equivalents).
  2. Tapo token pair — set_auth_token() sets only the Kasa token; there's no set_tapo_auth(), so consumers assign manager._tapo_token directly.

Adding these lets a stateless service restore a session through the library's contract instead of its internals, so a future refactor of those private names doesn't silently break downstream token restoration.

Context: raised in tplinkcloud-service#9 review. Not urgent — the consumer pins >=5.2.0,<6 and has a guard test asserting these internals exist — but the public surface is the right long-term fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions