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 for the currently-authenticated user.

force_auth_refresh()

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()

Log out of the current session (if any).

revoke_api_key(first_eight)

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

cache

event_hooks

httpx.Client event hooks.

tokens

A view of the current access and refresh tokens.