From 34854476850ea9c8878d82b745f775a1944fbfee Mon Sep 17 00:00:00 2001 From: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com> Date: Wed, 26 Feb 2025 15:21:28 -0500 Subject: [PATCH] Fix BaseClient not respecting retries and timeout - Fix `TypeError: BaseClient.__init__() got an unexpected keyword argument 'retries'` - Fix retries and timeout being reset to default value at the end of BaseClient.__init__() --- opa_client/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opa_client/base.py b/opa_client/base.py index a9cfeff..e3481a1 100644 --- a/opa_client/base.py +++ b/opa_client/base.py @@ -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): @@ -34,6 +35,7 @@ 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}" @@ -41,8 +43,6 @@ def __init__( 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