diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2783640..b6e3a50 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -273,7 +273,7 @@ When in doubt, follow the pattern used by existing files in the same directory. | Feature | `feature/` | `feature/add-snapmirror-example` | | Bug fix | `fix/` | `fix/nfs-provision-timeout` | | Release | `release/` | `release/0.2.0` | - + The default branch is `main`. All PRs target `main`. ### Tags and releases diff --git a/python/README.md b/python/README.md index 7146da6..9b6c2b2 100644 --- a/python/README.md +++ b/python/README.md @@ -37,13 +37,14 @@ pip install -r requirements.txt All scripts read connection details from environment variables. > **Important:** The values below are placeholders for illustration only. -> Replace `ONTAP_HOST`, `ONTAP_USER`, and `ONTAP_PASS` with your actual +> Replace `ONTAP_HOST`, `ONTAP_USER`, `ONTAP_TIMEOUT` and `ONTAP_PASS` with your actual > cluster details before running any script. ```bash export ONTAP_HOST=10.0.0.1 # cluster management LIF export ONTAP_USER=admin # default: admin export ONTAP_PASS=your_password +export ONTAP_TIMEOUT=your_timeout ``` Or use an env file: @@ -53,6 +54,7 @@ Or use an env file: ONTAP_HOST=10.0.0.1 ONTAP_USER=admin ONTAP_PASS=your_password +ONTAP_TIMEOUT=your_timeout ``` ```bash diff --git a/python/ontap_client.py b/python/ontap_client.py index 1f9e41e..16cd00b 100644 --- a/python/ontap_client.py +++ b/python/ontap_client.py @@ -79,10 +79,8 @@ def __init__( password: str, *, verify_ssl: bool = False, - timeout: int = _DEFAULT_TIMEOUT, ) -> None: self.base_url = f"https://{host}/api" - self.timeout = timeout self._session = requests.Session() self._session.auth = (username, password) self._session.verify = verify_ssl @@ -112,6 +110,7 @@ def from_env(cls) -> OntapClient: ``ONTAP_USER`` (default ``admin``), ``ONTAP_VERIFY_SSL`` (default ``false``) """ + timeout = int(os.environ.get("ONTAP_TIMEOUT",_DEFAULT_TIMEOUT)) host = os.environ.get("ONTAP_HOST", "") if not host: logger.error("ONTAP_HOST environment variable is required") @@ -126,6 +125,7 @@ def from_env(cls) -> OntapClient: username=os.environ.get("ONTAP_USER", "admin"), password=password, verify_ssl=os.environ.get("ONTAP_VERIFY_SSL", "false").lower() == "true", + timeout=timeout ) # -- HTTP helpers -------------------------------------------------------