tiled.client.context.Context

class tiled.client.context.Context(uri, *, headers=None, api_key=None, cache=<UNSET>, timeout=None, verify=True, 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, app=None, raise_server_exceptions=True)[source]

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__(/)

Default dir() implementation.

__enter__()

__eq__(value, /)

Return self==value.

__exit__(*args)

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getstate__()

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__(/)

Return hash(self).

__init__(uri, *[, headers, api_key, cache, ...])

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(*args, **kwargs)

__reduce__(/)

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__setstate__(state)

__sizeof__(/)

Size of object in memory, in bytes.

__str__(/)

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_token_directory()

authenticate(*[, remember_me])

Log in to a Tiled server.

close()

configure_auth(tokens[, remember_me])

Configure Tiled client with tokens for refresh flow.

create_api_key([scopes, expires_in, note, ...])

Generate a new API key.

force_auth_refresh()

Execute refresh flow.

from_any_uri(uri, *[, headers, api_key, ...])

Accept a URI to a specific node.

from_app(app, *[, cache, headers, timeout, ...])

Construct a Context around a FastAPI app.

login(*[, remember_me])

Log in to a Tiled server.

logout()

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.

use_cached_tokens()

Attempt to reconnect using cached tokens.

which_api_key()

A 'who am I' for API keys

whoami()

Return information about the currently-authenticated user or service.

Attributes

__annotations__

__dict__

__doc__

__module__

__weakref__

list of weak references to the object

api_key

app

authenticated

Boolean indicated whether session is authenticated (true) or anonymous (false)

base_url

cache

event_hooks

httpx.Client event hooks.

tokens

A view of the current access and refresh tokens.