pyrit.common.get_required_value

pyrit.common.get_required_value#

get_required_value(*, env_var_name: str, passed_value: str) str[source]#

Gets a required value from an environment variable or a passed value, prefering 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 (str) – The value passed to the function.

Returns:

The passed value if provided, otherwise the value from the environment variable.

Return type:

str

Raises:

ValueError – If neither the passed value nor the environment variable is provided.