sources.helpers.rest_client.detector
single_entity_path
def single_entity_path(path: str) -> bool
Checks if path ends with path param indicating that single object is returned
find_all_lists
def find_all_lists(
dict_: Dict[str, Any],
path: Tuple[str, ...] = (),
result: List[Tuple[Tuple[str, ...], List[Any]]] = None
) -> List[Tuple[Tuple[str, ...], List[Any]]]
Recursively looks for lists in dict_ and returns tuples in format (dictionary keys, list)
find_response_page_data
def find_response_page_data(
response: Union[Dict[str, Any], List[Any], Any]
) -> Tuple[Tuple[str, ...], Any]
Finds a path to response data, assuming that data is a list, returns a tuple(path, data)
single_page_detector
def single_page_detector(
response: Response) -> Tuple[SinglePagePaginator, float]
This is our fallback paginator, also for results that are single entities
PaginatorFactory Objects
class PaginatorFactory()
__init__
def __init__(detectors: List[Callable[[Response], Tuple[BasePaginator,
float]]] = None)
detectors
are functions taking Response as input and returning paginator instance and
detection score. Score value:
1.0 - perfect detection
0.0 - fallback detection
in between - partial detection, several paginator parameters are defaults