diff --git a/pygeodes/geodes.py b/pygeodes/geodes.py index 2a8bba7..8e888d3 100644 --- a/pygeodes/geodes.py +++ b/pygeodes/geodes.py @@ -186,7 +186,7 @@ def search_items( if not quiet: print(f"Found {matched} items matching your query") - if matched > MAX_NB_ITEMS: + if matched > self.conf.nb_max_items: raise TooManyResultsException( f"Your query matched with {matched} items, which is too much. Please refine your query to be more precise" ) diff --git a/pygeodes/utils/config.py b/pygeodes/utils/config.py index 452821a..8594002 100644 --- a/pygeodes/utils/config.py +++ b/pygeodes/utils/config.py @@ -17,6 +17,7 @@ from pygeodes.utils.consts import ( CONFIG_DEFAULT_FILENAME, + MAX_NB_ITEMS, DEFAULT_LOGGING_LEVEL, DEFAULT_S3_REGION_NAME, ) @@ -50,6 +51,7 @@ class Config: download_dir: str = "." checksum_error: bool = True use_async_requests: bool = True + nb_max_items: int = MAX_NB_ITEMS aws_access_key_id: str = None aws_secret_access_key: str = None aws_session_token: str = None # ajouter profil à la place diff --git a/pygeodes/utils/consts.py b/pygeodes/utils/consts.py index 0e9893a..afdf92b 100644 --- a/pygeodes/utils/consts.py +++ b/pygeodes/utils/consts.py @@ -38,8 +38,7 @@ # SSL_CERT_PATH = "/etc/pki/tls/cert.pem" #CNES certificate SSL_CERT_PATH = "" MAX_PAGE_SIZE = 80 -NB_PAGES_LIMIT = 10000000 -MAX_NB_ITEMS = MAX_PAGE_SIZE * NB_PAGES_LIMIT +MAX_NB_ITEMS = MAX_PAGE_SIZE * 10000000 DOWNLOAD_CHUNK_SIZE = 8192 MAX_NB_RETRIES = 5 TIME_BEFORE_RETRY = 2 diff --git a/tests/test_env/pygeodes-config.json b/tests/test_env/pygeodes-config.json index 92e2b84..16a07d3 100644 --- a/tests/test_env/pygeodes-config.json +++ b/tests/test_env/pygeodes-config.json @@ -3,6 +3,7 @@ "logging_level": "INFO", "download_dir": "./pygeodes/tests/test_env", "checksum_error": true, + "nb_max_items": 2000000, "use_async_requests": true, "aws_access_key_id": null, "aws_secret_access_key": null,