pyrit.common.get_required_value#
- get_required_value(*, env_var_name: str, passed_value: Any) Any[source]#
Get a required value from an environment variable or a passed value, preferring the passed value.
If no value is found, raises a KeyError
- Parameters:
env_var_name (str) – The name of the environment variable to check
passed_value – The value passed to the function. Can be a string or a callable that returns a string.
- Returns:
The passed value if provided, otherwise the value from the environment variable.
- Raises:
ValueError – If neither the passed value nor the environment variable is provided.