Skip to content

Fix BaseClient not respecting retries and timeout #30

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 opa_client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(
ssl: bool = False,
cert: Optional[Union[str, tuple]] = None,
headers: Optional[dict] = None,
retries: int = 2,
timeout: float = 1.5,
):
if not isinstance(port, int):
Expand All @@ -34,15 +35,14 @@ def __init__(
self.ssl = ssl
self.cert = cert
self.timeout = timeout
self.retries = retries

self.schema = "https://" if ssl else "http://"
self.root_url = f"{self.schema}{self.host}:{self.port}/{self.version}"

self.headers = headers

self._session = None # Will be initialized in the subclass
self.retries = 2
self.timeout = 1.5

def _build_url(
self, path: str, query_params: Dict[str, str] = None
Expand Down