las.credentials module
- class las.credentials.Credentials(client_id: str, client_secret: str, auth_endpoint: str, api_endpoint: str, cached_profile: Optional[str] = None, cache_path: pathlib.Path = PosixPath('/home/runner/.lucidtech/token-cache.json'))[source]
Bases:
object
Used to fetch and store credentials and to generate/cache an access token.
- Parameters
client_id – The client id
client_secret – The client secret
auth_endpoint – The auth endpoint
api_endpoint – The api endpoint
- property access_token: str
- las.credentials.guess_credentials() las.credentials.Credentials [source]
Tries to fetch Credentials first by looking at the environment variables, next by looking at the default credentials path ~/.lucidtech/credentials.cfg. Note that if not all the required environment variables are present, _all_ variables will be disregarded, and the credentials in the default path will be used.
- Returns
Credentials from file
- Return type
- Raises
MissingCredentials
- las.credentials.read_from_environ() List[Optional[str]] [source]
- Read the following environment variables and return them:
LAS_CLIENT_ID
LAS_CLIENT_SECRET
LAS_AUTH_ENDPOINT
LAS_API_ENDPOINT
- Returns
List of client_id, client_secret, auth_endpoint, api_endpoint
- Return type
List[Optional[str]]
- las.credentials.read_from_file(credentials_path: str = '/home/runner/.lucidtech/credentials.cfg', section: str = 'default') List[Optional[str]] [source]
Read a config file and return credentials from it. Defaults to ‘~/.lucidtech/credentials.cfg’.
- Parameters
credentials_path (str) – Path to read credentials from.
section (str) – Section to read credentials from.
- Returns
List of client_id, client_secret, auth_endpoint, api_endpoint
- Return type
List[Optional[str]]