|
10 | 10 | from typing import ( |
11 | 11 | Any, |
12 | 12 | Callable, |
13 | | - Dict, |
14 | 13 | Iterable, |
15 | 14 | List, |
16 | 15 | Mapping, |
|
42 | 41 | from airbyte_cdk.sources.declarative.requesters.requester import Requester |
43 | 42 | from airbyte_cdk.sources.declarative.retrievers.retriever import Retriever |
44 | 43 | from airbyte_cdk.sources.declarative.stream_slicers.stream_slicer import StreamSlicer |
45 | | -from airbyte_cdk.sources.http_logger import format_http_message |
46 | 44 | from airbyte_cdk.sources.source import ExperimentalClassWarning |
47 | 45 | from airbyte_cdk.sources.streams.core import StreamData |
48 | 46 | from airbyte_cdk.sources.types import Config, Record, StreamSlice, StreamState |
@@ -93,6 +91,7 @@ class SimpleRetriever(Retriever): |
93 | 91 | cursor: Optional[DeclarativeCursor] = None |
94 | 92 | ignore_stream_slicer_parameters_on_paginated_requests: bool = False |
95 | 93 | additional_query_properties: Optional[QueryProperties] = None |
| 94 | + log_formatter: Optional[Callable[[requests.Response], Any]] = None |
96 | 95 |
|
97 | 96 | def __post_init__(self, parameters: Mapping[str, Any]) -> None: |
98 | 97 | self._paginator = self.paginator or NoPagination(parameters=parameters) |
@@ -353,6 +352,7 @@ def _fetch_next_page( |
353 | 352 | stream_slice=stream_slice, |
354 | 353 | next_page_token=next_page_token, |
355 | 354 | ), |
| 355 | + log_formatter=self.log_formatter, |
356 | 356 | ) |
357 | 357 |
|
358 | 358 | # This logic is similar to _read_pages in the HttpStream class. When making changes here, consider making changes there as well. |
@@ -664,51 +664,6 @@ def __post_init__(self, options: Mapping[str, Any]) -> None: |
664 | 664 | def stream_slices(self) -> Iterable[Optional[StreamSlice]]: # type: ignore |
665 | 665 | return islice(super().stream_slices(), self.maximum_number_of_slices) |
666 | 666 |
|
667 | | - def _fetch_next_page( |
668 | | - self, |
669 | | - stream_state: Mapping[str, Any], |
670 | | - stream_slice: StreamSlice, |
671 | | - next_page_token: Optional[Mapping[str, Any]] = None, |
672 | | - ) -> Optional[requests.Response]: |
673 | | - is_dynamic_schema_call = self.name == "dynamic_properties" |
674 | | - return self.requester.send_request( |
675 | | - path=self._paginator_path( |
676 | | - next_page_token=next_page_token, |
677 | | - stream_state=stream_state, |
678 | | - stream_slice=stream_slice, |
679 | | - ), |
680 | | - stream_state=stream_state, |
681 | | - stream_slice=stream_slice, |
682 | | - next_page_token=next_page_token, |
683 | | - request_headers=self._request_headers( |
684 | | - stream_state=stream_state, |
685 | | - stream_slice=stream_slice, |
686 | | - next_page_token=next_page_token, |
687 | | - ), |
688 | | - request_params=self._request_params( |
689 | | - stream_state=stream_state, |
690 | | - stream_slice=stream_slice, |
691 | | - next_page_token=next_page_token, |
692 | | - ), |
693 | | - request_body_data=self._request_body_data( |
694 | | - stream_state=stream_state, |
695 | | - stream_slice=stream_slice, |
696 | | - next_page_token=next_page_token, |
697 | | - ), |
698 | | - request_body_json=self._request_body_json( |
699 | | - stream_state=stream_state, |
700 | | - stream_slice=stream_slice, |
701 | | - next_page_token=next_page_token, |
702 | | - ), |
703 | | - log_formatter=lambda response: format_http_message( |
704 | | - response, |
705 | | - f"Stream '{self.name}' request", |
706 | | - f"Request performed in order to extract records for stream '{self.name}'", |
707 | | - self.name, |
708 | | - is_auxiliary=is_dynamic_schema_call, # Mark schema discovery calls as auxiliary for cleaner logs |
709 | | - ), |
710 | | - ) |
711 | | - |
712 | 667 |
|
713 | 668 | @deprecated( |
714 | 669 | "This class is experimental. Use at your own risk.", |
|
0 commit comments