pydoc > dotenv

Help on package dotenv:

NAME
    dotenv

PACKAGE CONTENTS
    __main__
    cli
    ipython
    main
    parser
    variables
    version

FUNCTIONS
    dotenv_values(dotenv_path: Union[str, ForwardRef('os.PathLike[str]'), NoneType] = None, stream: Optional[IO[str]] = None, verbose: bool = False, interpolate: bool = True, encoding: Optional[str] = 'utf-8') -> Dict[str, Optional[str]]
        Parse a .env file and return its content as a dict.

        The returned dict will have `None` values for keys without values in the .env file.
        For example, `foo=bar` results in `{"foo": "bar"}` whereas `foo` alone results in
        `{"foo": None}`

        Parameters:
            dotenv_path: Absolute or relative path to the .env file.
            stream: `StringIO` object with .env content, used if `dotenv_path` is `None`.
            verbose: Whether to output a warning if the .env file is missing.
            encoding: Encoding to be used to read the file.

        If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the
        .env file.

    find_dotenv(filename: str = '.env', raise_error_if_not_found: bool = False, usecwd: bool = False) -> str
        Search in increasingly higher folders for the given file

        Returns path to the file if found, or an empty string otherwise

    get_cli_string(path: Optional[str] = None, action: Optional[str] = None, key: Optional[str] = None, value: Optional[str] = None, quote: Optional[str] = None)
        Returns a string suitable for running as a shell script.

        Useful for converting a arguments passed to a fabric task
        to be passed to a `local` or `run` command.

    get_key(dotenv_path: Union[str, ForwardRef('os.PathLike[str]')], key_to_get: str, encoding: Optional[str] = 'utf-8') -> Optional[str]
        Get the value of a given key from the given .env.

        Returns `None` if the key isn't found or doesn't have a value.

    load_dotenv(dotenv_path: Union[str, ForwardRef('os.PathLike[str]'), NoneType] = None, stream: Optional[IO[str]] = None, verbose: bool = False, override: bool = False, interpolate: bool = True, encoding: Optional[str] = 'utf-8') -> bool
        Parse a .env file and then load all the variables found as environment variables.

        Parameters:
            dotenv_path: Absolute or relative path to .env file.
            stream: Text stream (such as `io.StringIO`) with .env content, used if
                `dotenv_path` is `None`.
            verbose: Whether to output a warning the .env file is missing.
            override: Whether to override the system environment variables with the variables
                from the `.env` file.
            encoding: Encoding to be used to read the file.
        Returns:
            Bool: True if at least one environment variable is set else False

        If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the
        .env file with it's default parameters. If you need to change the default parameters
        of `find_dotenv()`, you can explicitly call `find_dotenv()` and pass the result
        to this function as `dotenv_path`.

        If the environment variable `PYTHON_DOTENV_DISABLED` is set to a truthy value,
        .env loading is disabled.

    load_ipython_extension(ipython: Any) -> None

    set_key(dotenv_path: Union[str, ForwardRef('os.PathLike[str]')], key_to_set: str, value_to_set: str, quote_mode: str = 'always', export: bool = False, encoding: Optional[str] = 'utf-8', follow_symlinks: bool = False) -> Tuple[Optional[bool], str, str]
        Adds or Updates a key/value to the given .env

        The target .env file is created if it doesn't exist.

        This function doesn't follow symlinks by default, to avoid accidentally
        modifying a file at a potentially untrusted path. If you don't need this
        protection and need symlinks to be followed, use `follow_symlinks`.

    unset_key(dotenv_path: Union[str, ForwardRef('os.PathLike[str]')], key_to_unset: str, quote_mode: str = 'always', encoding: Optional[str] = 'utf-8', follow_symlinks: bool = False) -> Tuple[Optional[bool], str]
        Removes a given key from the given `.env` file.

        If the .env path given doesn't exist, fails.
        If the given key doesn't exist in the .env, fails.

        This function doesn't follow symlinks by default, to avoid accidentally
        modifying a file at a potentially untrusted path. If you don't need this
        protection and need symlinks to be followed, use `follow_symlinks`.

DATA
    __all__ = ['get_cli_string', 'load_dotenv', 'dotenv_values', 'get_key'...

FILE
    /home/chedong/.local/lib/python3.10/site-packages/dotenv/__init__.py


dotenv
NAME PACKAGE CONTENTS FUNCTIONS
dotenv_values(dotenv_path: Union[str, ForwardRef('os.PathLike[str]'), NoneType] = None, stream: Optional[IO[str]] = None, verbose: bool = False, interpolate: bool = True, encoding: Optional[str] = 'utf-8') -> Dict[str, Optional[str]] find_dotenv(filename: str = '.env', raise_error_if_not_found: bool = False, usecwd: bool = False) -> str get_cli_string(path: Optional[str] = None, action: Optional[str] = None, key: Optional[str] = None, value: Optional[str] = None, quote: Optional[str] = None) get_key(dotenv_path: Union[str, ForwardRef('os.PathLike[str]')], key_to_get: str, encoding: Optional[str] = 'utf-8') -> Optional[str] load_dotenv(dotenv_path: Union[str, ForwardRef('os.PathLike[str]'), NoneType] = None, stream: Optional[IO[str]] = None, verbose: bool = False, override: bool = False, interpolate: bool = True, encoding: Optional[str] = 'utf-8') -> bool load_ipython_extension(ipython: Any) -> None set_key(dotenv_path: Union[str, ForwardRef('os.PathLike[str]')], key_to_set: str, value_to_set: str, quote_mode: str = 'always', export: bool = False, encoding: Optional[str] = 'utf-8', follow_symlinks: bool = False) -> Tuple[Optional[bool], str, str] unset_key(dotenv_path: Union[str, ForwardRef('os.PathLike[str]')], key_to_unset: str, quote_mode: str = 'always', encoding: Optional[str] = 'utf-8', follow_symlinks: bool = False) -> Tuple[Optional[bool], str]
DATA FILE

Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 18:57 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^