(dot_env_path)
return env_variables_mapping
load .env file.

    Args:
        dot_env_path (str): .env file path

    Returns:
        dict: environment variables mapping

            {
                "UserName": "debugtalk",
                "Password": "123456",
                "PROJECT_KEY": "ABCDEFGH"
            }

    Raises:
        exceptions.FileFormatError: If .env file format is invalid.
load .env file.
load . env file .
def load_dot_env_file(dot_env_path):
    """ load .env file.

    Args:
        dot_env_path (str): .env file path

    Returns:
        dict: environment variables mapping

            {
                "UserName": "debugtalk",
                "Password": "123456",
                "PROJECT_KEY": "ABCDEFGH"
            }

    Raises:
        exceptions.FileFormatError: If .env file format is invalid.

    """
    if not os.path.isfile(dot_env_path):
        return {}

    logger.log_info("Loading environment variables from {}".format(dot_env_path))
    env_variables_mapping = {}

    with io.open(dot_env_path, 'r', encoding='utf-8') as fp:
        for line in fp:
            # maxsplit=1
            if "=" in line:
                variable, value = line.split("=", 1)
            elif ":" in line:
                variable, value = line.split(":", 1)
            else:
                raise exceptions.FileFormatError(".env format error")

            env_variables_mapping[variable.strip()] = value.strip()

    utils.set_os_environ(env_variables_mapping)
    return env_variables_mapping
def load_dot_env_file ( dot_env_path ) : if not os . path . isfile ( dot_env_path ) : return { } logger . log_info ( "Loading environment variables from {}" . format ( dot_env_path ) ) env_variables_mapping = { } with io . open ( dot_env_path , 'r' , encoding = 'utf-8' ) as fp : for line in fp : # maxsplit=1 if "=" in line : variable , value = line . split ( "=" , 1 ) elif ":" in line : variable , value = line . split ( ":" , 1 ) else : raise exceptions . FileFormatError ( ".env format error" ) env_variables_mapping [ variable . strip ( ) ] = value . strip ( ) utils . set_os_environ ( env_variables_mapping ) return env_variables_mapping