Session
User sessions: a short-lived token for one user, safe to hand to a browser.
session = user.session(scopes=["agents", "humans"], ttl_s=3600)
token = session.token # your frontend uses it as its API key
client = noclick.Client.for_session(session) # or act as that user from Pythonclass SessionA token pinned to one user with a subset of the minting key's scopes.
Its repr never shows the token.
Attributes
| token | str | |
| id | str | None | |
| user_id | str | None | |
| scopes | list[str] | |
| expires_at | Any | |
| raw | dict[str, Any] | The response JSON exactly as the API sent it. |
| base_url | str | None | |
| expired | bool | Whether |
client
session.client(**kwargs) -> AnyA client that acts as this session: noclick.Agent.list(client=session.client()).
Parameters
**kwargsAny
Returns
Any
A client holding the session's token, pointed at the API the session came from. Every call it makes acts as the session's user, with the session's scopes.
Usage
user = noclick.User.from_id("user_42")
session = user.session(["agents"], ttl_s=600)
as_ana = session.client()
noclick.Agent.list(client=as_ana) # Ana's agents and the shared ones, nothing else