tiled.client.context.Context

class tiled.client.context.Context(client, *, username=None, auth_provider=None, api_key=None, cache=None, offline=False, token_cache='/home/runner/.config/tiled/tokens', prompt_for_reauthentication=PromptForReauthentication.AT_INIT, app=None)[source]

Wrap an httpx.Client with an optional cache and authentication functionality.

__init__(client, *, username=None, auth_provider=None, api_key=None, cache=None, offline=False, token_cache='/home/runner/.config/tiled/tokens', prompt_for_reauthentication=PromptForReauthentication.AT_INIT, app=None)[source]

Methods

__init__(client, *[, username, ...])

authenticate([provider])

Authenticate.

disable_cache([allow_read, allow_write])

get_content(path[, accept, stream, revalidate])

get_json(path[, stream])

logout()

Clear the access token and the cached refresh token.

new_api_key([scopes, lifetime, note])

Generate a new API for the currently-authenticated user.

post_json(path, content)

reauthenticate([prompt])

Refresh authentication.

revalidation(revalidate)

Temporarily change the 'revalidate' property in a context.

revoke_api_key(uuid)

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.

offline

path_parts

revalidate

This controls how aggressively to check whether cache entries are out of date.

tokens

A view of the current access and refresh tokens.