Better Python secrets management

Опубликовано: 28 Июнь 2026
на канале: Matt Palmer
100
1

Learn the most secure way to manage secrets in Python projects - no more .env files in your project directory.

Great for anyone who uses Jupyter or works in python frequently.

```
pip install python-dotenv
```

```
import os
from dotenv import load_dotenv

secrets_dir = os.path.expanduser("~/Documents/secrets")

config = {
**dotenv_values(secrets_dir + "/.env.openai"),
}

config.get("OPENAI_API_KEY")
```