diff --git a/README.md b/README.md index 2cc402b5..5a9360a8 100644 --- a/README.md +++ b/README.md @@ -162,8 +162,6 @@ The SDK and CLI read credentials from environment variables such as `IMEDNET_API_KEY` and `IMEDNET_SECURITY_KEY`. You can set these in your shell or use a `.env` file. Copy `.env.example` to `.env` to get started. -> **Note**: `imednet.load_config()` only reads from existing environment variables (`os.getenv`). While the CLI automatically loads `.env` files, standalone Python scripts must explicitly call `load_dotenv()` from the `python-dotenv` package to read from a `.env` file before calling `load_config()`. - See [configuration](docs/configuration.rst) for the complete list of options. Use `imednet.config.load_config()` to access these values in your code. diff --git a/examples/async_quick_start.py b/examples/async_quick_start.py index 619c8983..975617be 100644 --- a/examples/async_quick_start.py +++ b/examples/async_quick_start.py @@ -28,6 +28,9 @@ async def main() -> None: configure_json_logging() load_dotenv() + # Load environment variables from .env file if it exists + load_dotenv() + try: cfg = load_config() except ValueError as e: diff --git a/examples/quick_start.py b/examples/quick_start.py index 7135daf5..21dabab6 100644 --- a/examples/quick_start.py +++ b/examples/quick_start.py @@ -25,6 +25,9 @@ def main() -> None: configure_json_logging() load_dotenv() + # Load environment variables from .env file if it exists + load_dotenv() + try: cfg = load_config() except ValueError as e: