From 946fcd07346927618767ded070ff332c7c581e12 Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 13 May 2024 14:05:40 +0200 Subject: [PATCH] improve paginator errors --- dlt/sources/helpers/rest_client/paginators.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlt/sources/helpers/rest_client/paginators.py b/dlt/sources/helpers/rest_client/paginators.py index 11efd0215a..b38665aa69 100644 --- a/dlt/sources/helpers/rest_client/paginators.py +++ b/dlt/sources/helpers/rest_client/paginators.py @@ -233,6 +233,8 @@ def __init__( data is available. This allows you to limit the maximum number of pages for pagination. Defaults to None. """ + if total_path is None and maximum_page is None: + raise ValueError("Either `total_path` or `maximum_page` must be provided.") super().__init__( param_name=page_param, initial_value=initial_page, @@ -321,6 +323,8 @@ def __init__( even if more data is available. This allows you to limit the maximum range for pagination. Defaults to None. """ + if total_path is None and maximum_offset is None: + raise ValueError("Either `total_path` or `maximum_offset` must be provided.") super().__init__( param_name=offset_param, initial_value=offset,