Skip to main content
Store API keys, connection details, or other configuration on the Python asset’s Variables step. Values are stored encrypted. Anyone with edit access to this asset can retrieve them in the script. Your script reads them with the SDK.
less.get_variable(name) returns the value for that name. If the variable is not defined on this asset (and was not passed as an execute parameter), it raises less.LessException and stops the script.
less.get_variables() returns a dict of every variable on this asset. Add variables in Less when you create or edit the Python asset: Variables step → Add variable. Names must be unique and use letters, numbers, and underscores (for example API_KEY).

Overwrite with parameters

When you start a run with the public API, you can send parameters in the request body. Those values overwrite matching Variables for that run — the same as sources and models. Extra parameter keys that are not on the Variables step are included.
Use less.get_variable() / less.get_variables() for the overlayed values used for the run. To inspect only the execute payload — without Variables-step values — use less.get_parameter() / less.get_parameters().
less.get_parameter(name) raises less.LessException if that name was not in the execute request. Local runs have no job, so get_parameters() returns an empty dict until the script runs on Less as part of a job.