From 487e7ae72121e8d2bea608b5f049ad774ce20d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Thu, 8 Aug 2024 18:00:30 -0600 Subject: [PATCH] refactor: Made `auth_headers` and `auth_params` of `APIAuthenticatorBase` simple instance attributes instead of decorated properties Closes https://github.com/meltano/sdk/issues/925 --- singer_sdk/authenticators.py | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/singer_sdk/authenticators.py b/singer_sdk/authenticators.py index 21ef1ba222..7b765486fb 100644 --- a/singer_sdk/authenticators.py +++ b/singer_sdk/authenticators.py @@ -79,7 +79,12 @@ def __call__(cls, *args: t.Any, **kwargs: t.Any) -> t.Any: # noqa: ANN401 class APIAuthenticatorBase: - """Base class for offloading API auth.""" + """Base class for offloading API auth. + + Attributes: + auth_headers: HTTP headers for authentication. + auth_params: URL query parameters for authentication. + """ def __init__(self, stream: RESTStream) -> None: """Init authenticator. @@ -89,8 +94,8 @@ def __init__(self, stream: RESTStream) -> None: """ self.tap_name: str = stream.tap_name self._config: dict[str, t.Any] = dict(stream.config) - self._auth_headers: dict[str, t.Any] = {} - self._auth_params: dict[str, t.Any] = {} + self.auth_headers: dict[str, t.Any] = {} + self.auth_params: dict[str, t.Any] = {} self.logger: logging.Logger = stream.logger @property @@ -102,24 +107,6 @@ def config(self) -> t.Mapping[str, t.Any]: """ return MappingProxyType(self._config) - @property - def auth_headers(self) -> dict: - """Get headers. - - Returns: - HTTP headers for authentication. - """ - return self._auth_headers or {} - - @property - def auth_params(self) -> dict: - """Get query parameters. - - Returns: - URL query parameters for authentication. - """ - return self._auth_params or {} - def authenticate_request( self, request: requests.PreparedRequest,