MCPcopy Index your code
hub / github.com/theskumar/python-dotenv / get_key

Function get_key

src/dotenv/main.py:125–135  ·  view source on GitHub ↗

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.

(
    dotenv_path: StrPath,
    key_to_get: str,
    encoding: Optional[str] = "utf-8",
)

Source from the content-addressed store, hash-verified

123
124
125def get_key(
126 dotenv_path: StrPath,
127 key_to_get: str,
128 encoding: Optional[str] = "utf-8",
129) -> Optional[str]:
130 """
131 Get the value of a given key from the given .env.
132
133 Returns `None` if the key isn't found or doesn't have a value.
134 """
135 return DotEnv(dotenv_path, verbose=True, encoding=encoding).get(key_to_get)
136
137
138@contextmanager

Callers

nothing calls this directly

Calls 2

DotEnvClass · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…