diff --git a/cookiecutter/tap-template/{{cookiecutter.tap_id}}/{{cookiecutter.library_name}}/rest-client.py b/cookiecutter/tap-template/{{cookiecutter.tap_id}}/{{cookiecutter.library_name}}/rest-client.py index 26c1447c9..16ad9d23f 100644 --- a/cookiecutter/tap-template/{{cookiecutter.tap_id}}/{{cookiecutter.library_name}}/rest-client.py +++ b/cookiecutter/tap-template/{{cookiecutter.tap_id}}/{{cookiecutter.library_name}}/rest-client.py @@ -22,7 +22,7 @@ from singer_sdk.streams import {{ cookiecutter.stream_type }}Stream {% elif cookiecutter.auth_method == "Basic Auth" -%} -from singer_sdk.authenticators import BasicAuthenticator +from requests.auth import HTTPBasicAuth from singer_sdk.helpers.jsonpath import extract_jsonpath from singer_sdk.pagination import BaseAPIPaginator # noqa: TCH002 from singer_sdk.streams import {{ cookiecutter.stream_type }}Stream @@ -110,14 +110,13 @@ def authenticator(self) -> BearerTokenAuthenticator: {%- elif cookiecutter.auth_method == "Basic Auth" %} @property - def authenticator(self) -> BasicAuthenticator: + def authenticator(self) -> HTTPBasicAuth: """Return a new authenticator object. Returns: An authenticator instance. """ - return BasicAuthenticator.create_for_stream( - self, + return HTTPBasicAuth( username=self.config.get("username", ""), password=self.config.get("password", ""), ) diff --git a/pyproject.toml b/pyproject.toml index d22e6c693..5de8456b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -249,6 +249,10 @@ jsonl = "singer_sdk.contrib.batch_encoder_jsonl:JSONLinesBatcher" parquet = "singer_sdk.contrib.batch_encoder_parquet:ParquetBatcher" [tool.ruff] +extend-exclude = [ + "cookiecutter/*", + "*simpleeval*", +] line-length = 88 src = ["samples", "singer_sdk", "tests"] target-version = "py38" @@ -257,10 +261,6 @@ target-version = "py38" docstring-code-format = true [tool.ruff.lint] -exclude = [ - "cookiecutter/*", - "*simpleeval*", -] ignore = [ "ANN101", # Missing type annotation for `self` in method "ANN102", # Missing type annotation for `cls` in class method diff --git a/singer_sdk/authenticators.py b/singer_sdk/authenticators.py index 82e0556bc..70004efbe 100644 --- a/singer_sdk/authenticators.py +++ b/singer_sdk/authenticators.py @@ -297,7 +297,10 @@ def create_for_stream( class BasicAuthenticator(APIAuthenticatorBase): """Implements basic authentication for REST Streams. - This Authenticator implements basic authentication by concatinating a + .. deprecated:: 0.36.0 + Use :class:`requests.auth.HTTPBasicAuth` instead. + + This Authenticator implements basic authentication by concatenating a username and password then base64 encoding the string. The resulting token will be merged with any HTTP headers specified on the stream. """ diff --git a/singer_sdk/helpers/_flattening.py b/singer_sdk/helpers/_flattening.py index 2a3e194d0..9dcbf1281 100644 --- a/singer_sdk/helpers/_flattening.py +++ b/singer_sdk/helpers/_flattening.py @@ -33,7 +33,7 @@ def get_flattening_options( Returns: A new FlatteningOptions object or None if flattening is disabled. """ - if plugin_config.get("flattening_enabled"): + if plugin_config.get("flattening_enabled", False): return FlatteningOptions(max_level=int(plugin_config["flattening_max_depth"])) return None