diff --git a/singer_sdk/streams/rest.py b/singer_sdk/streams/rest.py index 983abefd6..934cc23e6 100644 --- a/singer_sdk/streams/rest.py +++ b/singer_sdk/streams/rest.py @@ -16,6 +16,7 @@ TypeVar, Union, ) +from urllib.parse import urlparse import backoff import requests @@ -180,12 +181,15 @@ def validate_response(self, response: requests.Response) -> None: def response_error_message(self, response: requests.Response) -> str: """Build error message for invalid http statuses. + WARNING - Override this method when the URL path may contain secrets or PII + Args: response: A `requests.Response`_ object. Returns: str: The error message """ + full_path = urlparse(response.url).path or self.path if 400 <= response.status_code < 500: error_type = "Client" else: @@ -193,7 +197,7 @@ def response_error_message(self, response: requests.Response) -> str: return ( f"{response.status_code} {error_type} Error: " - f"{response.reason} for path: {self.path}" + f"{response.reason} for path: {full_path}" ) def request_decorator(self, func: Callable) -> Callable: