Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] OP_CONNECT_CLIENT_REQUEST_TIMEOUT default value was wrong #103

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Check the [Python Connect SDK Example](example/README.md) to see an example of i
export OP_CONNECT_TOKEN=<your-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:
Expand Down
9 changes: 4 additions & 5 deletions src/onepasswordconnectsdk/utils.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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
Loading