airbyte_cdk.sources.declarative.extractors.http_selector
1# 2# Copyright (c) 2023 Airbyte, Inc., all rights reserved. 3# 4 5from abc import abstractmethod 6from typing import Any, Iterable, Mapping, Optional 7 8import requests 9 10from airbyte_cdk.sources.types import Record, StreamSlice, StreamState 11 12 13class HttpSelector: 14 """ 15 Responsible for translating an HTTP response into a list of records by extracting records from the response and optionally filtering 16 records based on a heuristic. 17 """ 18 19 @abstractmethod 20 def select_records( 21 self, 22 response: requests.Response, 23 stream_state: StreamState, 24 records_schema: Mapping[str, Any], 25 stream_slice: Optional[StreamSlice] = None, 26 next_page_token: Optional[Mapping[str, Any]] = None, 27 ) -> Iterable[Record]: 28 """ 29 Selects records from the response 30 :param response: The response to select the records from 31 :param stream_state: The stream state 32 :param records_schema: json schema of records to return 33 :param stream_slice: The stream slice 34 :param next_page_token: The paginator token 35 :return: List of Records selected from the response 36 """ 37 pass
class
HttpSelector:
14class HttpSelector: 15 """ 16 Responsible for translating an HTTP response into a list of records by extracting records from the response and optionally filtering 17 records based on a heuristic. 18 """ 19 20 @abstractmethod 21 def select_records( 22 self, 23 response: requests.Response, 24 stream_state: StreamState, 25 records_schema: Mapping[str, Any], 26 stream_slice: Optional[StreamSlice] = None, 27 next_page_token: Optional[Mapping[str, Any]] = None, 28 ) -> Iterable[Record]: 29 """ 30 Selects records from the response 31 :param response: The response to select the records from 32 :param stream_state: The stream state 33 :param records_schema: json schema of records to return 34 :param stream_slice: The stream slice 35 :param next_page_token: The paginator token 36 :return: List of Records selected from the response 37 """ 38 pass
Responsible for translating an HTTP response into a list of records by extracting records from the response and optionally filtering records based on a heuristic.
@abstractmethod
def
select_records( self, response: requests.models.Response, stream_state: Mapping[str, Any], records_schema: Mapping[str, Any], stream_slice: Optional[airbyte_cdk.StreamSlice] = None, next_page_token: Optional[Mapping[str, Any]] = None) -> Iterable[airbyte_cdk.Record]:
20 @abstractmethod 21 def select_records( 22 self, 23 response: requests.Response, 24 stream_state: StreamState, 25 records_schema: Mapping[str, Any], 26 stream_slice: Optional[StreamSlice] = None, 27 next_page_token: Optional[Mapping[str, Any]] = None, 28 ) -> Iterable[Record]: 29 """ 30 Selects records from the response 31 :param response: The response to select the records from 32 :param stream_state: The stream state 33 :param records_schema: json schema of records to return 34 :param stream_slice: The stream slice 35 :param next_page_token: The paginator token 36 :return: List of Records selected from the response 37 """ 38 pass
Selects records from the response
Parameters
- response: The response to select the records from
- stream_state: The stream state
- records_schema: json schema of records to return
- stream_slice: The stream slice
- next_page_token: The paginator token
Returns
List of Records selected from the response