get_valid_url

get_valid_url(env_var, default)[source]

Fetches one or more URLs from an environment variable. If a comma-delimited string is provided, it is split and each URL is validated. Falls back to the default if any URL is invalid or not set.

Parameters:
  • env_var (str) -- The name of the environment variable.

  • default (str | list[str]) -- A single default URL or a list of default URLs.

Returns:

A valid URL string or a list of valid URL strings.

Return type:

str | list[str]