tiled.client.context.Context
- class tiled.client.context.Context(uri, *, headers=None, api_key=None, cache=<UNSET>, timeout=None, verify=True, token_cache=None, app=None, raise_server_exceptions=True)[source]
Wrap an httpx.Client with an optional cache and authentication functionality.
- __init__(uri, *, headers=None, api_key=None, cache=<UNSET>, timeout=None, verify=True, token_cache=None, app=None, raise_server_exceptions=True)[source]
Methods
__init__
(uri, *[, headers, api_key, cache, ...])authenticate
([username, provider, ...])See login.
close
()create_api_key
([scopes, expires_in, note])Generate a new API key.
Execute refresh flow.
from_any_uri
(uri, *[, headers, api_key, ...])Accept a URI to a specific node.
from_app
(app, *[, cache, token_cache, ...])Construct a Context around a FastAPI app.
login
([username, provider, ...])Depending on the server's authentication method, this will prompt for username/password:
logout
([clear_default])Log out of the current session (if any).
revoke_api_key
(first_eight)Revoke an API key.
revoke_session
(session_id)Revoke a Session so it cannot be refreshed.
which_api_key
()A 'who am I' for API keys
whoami
()Return information about the currently-authenticated user or service.
Attributes
api_key
app
base_url
event_hooks
httpx.Client event hooks.
A view of the current access and refresh tokens.