Authorization header. The client resolves the token from the first of these sources that is set:
credentials=orapi_key=passed to the client;- a named
profile=; - the
GWENLAKE_API_KEYenvironment variable; - the
defaultprofile of~/.gwenlake/credentials.
GwenlakeException.
- Environment variable
- Explicit key
- Profile
- Credentials object
API keys
An API key is a static token that identifies you and carries your permissions on the organizations and projects you belong to. Create and revoke keys from the platform. A key never expires on its own, so rotate it when it leaks.The credentials file
~/.gwenlake/credentials (%APPDATA%\.gwenlake\credentials on Windows) is an INI file with one section per profile. A profile holds either a static token or an OAuth2 client_id and client_secret, and may name the endpoint it is for with base_url (or host: a bare host such as atlas.acme.example, completed to its API prefix), for a tenant deployed on its own host. hostname is something else: the OAuth server of a client-credentials profile.
~/.gwenlake/credentials
Gwenlake(profile="myteam") or, on the command line, gwenlake --profile myteam .... The command line also writes the file: gwenlake config set-profile acme --token sk-... --base-url https://atlas.acme.example/v1 (see Command line).
OAuth2 clients
For a service that must not hold a personal key, use an OAuth2 client with the client-credentials flow. The library exchanges the client id and secret for a token againstauth.gwenlake.com and refreshes it in the background, one minute before it expires.
creds.is_configured tells whether the credentials can produce a token, and creds.sign_out() revokes the current one.