scitex_hub.account.whoami
Python parity for scitex-hub account whoami.
Same identity probe the CLI whoami verb hits — GET /api/me/ —
so an agent-programmatic caller can confirm “is my cached token still
valid?” without shelling out.
Functions
|
Return the username + email the cached bearer authenticates as. |
- scitex_hub.account.whoami.whoami(*, server: str | None = None, request_fn=None) dict[source]
Return the username + email the cached bearer authenticates as.
- Parameters:
server – Override server URL. Defaults to
_auth.resolve_server()(env / cache / scitex.ai).request_fn – Dependency-injection seam for the HTTP GET. When
None, usesrequests.get. Tests inject a fake that returns the same{status_code, json, text}dict shape the real transport produces.
- Returns:
Dict with at least
usernameandemail(server may add more fields likeidoris_staff).- Raises:
RuntimeError – No bearer token resolved (not logged in), token expired (401), or server returned non-200.
Example
>>> from scitex_hub.account.whoami import whoami >>> whoami() {'username': 'ywatanabe', 'email': 'ywatanabe@scitex.ai'}