The LimaCharlie Python API brings many new quality of life changes.
The core of those changes is how Credentials are used. In the past, credentials had to be passed individually to API calls or to CLI components. This was a pain because it required a lot of copy and pasting of OIDs and API keys.
Now, you have 3 main ways of dealing with credentials.
You can still use individual credentials passed to API calls and CLI modules. However, all parts of the Python API now accept None as OID and API key, and if neither are present, they will fall back onto two new methods:
- Environment variables have been introduced:
- LC_OID: this is the Organization ID you would like to use.
- LC_API_KEY: this is the API Key you would like to use.
- LC_CREDS_FILE: if the LC_API_KEY is not present, this can point to a simple YAML file on disk with "oid" and "api_key" values to use.
- If no environment variables are present, the API will fallback to the "~/.limacharlie" file in the current user's home directory. The contents of this file are identical to the LC_CREDS_FILE mentioned above.
For operators, this method #2 tends to be the easiest since it doesn't rely on setting environment variables manually.
To facilitate this, we also introduced the follow CLI call: "python -m limacharlie login". This will prompt you for your OID and API Key and will generate the "~/.limacharlie" in the current user's home directory for you. This is by far the simplest way to get going. Afterwards, no more need to specify credentials manually.
We really hope this simple yet powerful mechanism will make your life easier as much as it did for us. For us, this solidifies the position of the Python API as more than a library to simplify automation of the REST API. We see the Python API as the official CLI for LimaCharlie, much like the "aws" and "gcloud" or "firebase" CLIs.