diff --git a/README.md b/README.md index df598e9..63e8cfa 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ Check the [Python Connect SDK Example](example/README.md) to see an example of i export OP_CONNECT_TOKEN= ``` - 2.1 If you need a higher timeout on the client requests you can export `OP_CLIENT_REQUEST_TIMEOUT` environment variable: + 2.1 If you need a higher timeout on the client requests you can export `OP_CONNECT_CLIENT_REQUEST_TIMEOUT` environment variable: ```sh # set the timeout to 90 seconds - export OP_CLIENT_REQUEST_TIMEOUT=90 + export OP_CONNECT_CLIENT_REQUEST_TIMEOUT=90 ``` 3. Use the SDK: diff --git a/src/onepasswordconnectsdk/utils.py b/src/onepasswordconnectsdk/utils.py index 6699e42..2ff6b61 100644 --- a/src/onepasswordconnectsdk/utils.py +++ b/src/onepasswordconnectsdk/utils.py @@ -1,11 +1,10 @@ import os from typing import Union -from httpx import USE_CLIENT_DEFAULT -from httpx._client import UseClientDefault +from httpx._config import DEFAULT_TIMEOUT_CONFIG, Timeout UUIDLength = 26 -ENV_CLIENT_REQUEST_TIMEOUT = "OP_CONNECT_CLIENT_REQ_TIMEOUT" +ENV_CLIENT_REQUEST_TIMEOUT = "OP_CONNECT_CLIENT_REQUEST_TIMEOUT" def is_valid_uuid(uuid): @@ -68,7 +67,7 @@ def _append_path(self, path_chunk: str = None, query: str = None) -> 'PathBuilde self.path += f"?{query}" -def get_timeout() -> Union[int, UseClientDefault]: +def get_timeout() -> Union[int, Timeout]: """Get the timeout to be used in the HTTP Client""" timeout = int(os.getenv(ENV_CLIENT_REQUEST_TIMEOUT, 0)) - return timeout if timeout else USE_CLIENT_DEFAULT + return timeout if timeout else DEFAULT_TIMEOUT_CONFIG