Skip to content

Configuration

The environment variables the Python SDK reads, and the client settings they correspond to.

Environment variables

Variable Used by Meaning
SWEATSTACK_API_KEY Client The access token, if none is passed to Client(api_key=...).
SWEATSTACK_REFRESH_TOKEN Client The refresh token, if none is passed to Client(refresh_token=...).
SWEATSTACK_URL Client The SweatStack instance, if none is passed to Client(url=...). Default https://app.sweatstack.no.
SWEATSTACK_CLIENT_ID Streamlit, FastAPI Your app's client ID.
SWEATSTACK_CLIENT_SECRET Streamlit, FastAPI Your app's client secret.
SWEATSTACK_REDIRECT_URI Streamlit The app's redirect URI.
SWEATSTACK_SCOPES Streamlit Comma-separated scopes. Default data:read,profile.
SWEATSTACK_SESSION_SECRET FastAPI The key that encrypts the session cookie.
SWEATSTACK_WEBHOOK_SECRET FastAPI The secret that verifies webhook signatures.
APP_URL FastAPI Your app's base URL.

A value passed in code always wins over the environment. See Authentication for the order in which the SDK looks for credentials.

Client settings

Client(timeout=60.0, max_retries=2, output=None): the request timeout in seconds, how often to retry a failed GET, PUT or DELETE, and the default output. See Errors and Data output.

Cache

sweatstack.enable_cache(path=None) caches the responses of activities.longitudinal.data() and activities.longitudinal.mean_max() on disk, per user. The default location is the platform's cache directory (~/Library/Caches/SweatStack/ on macOS, ~/.cache/SweatStack/ on Linux). client.clear_cache() deletes the cache of the signed-in user. See Data output.