From 73c4f989b04864ef091244d8f1eb8196b5272b78 Mon Sep 17 00:00:00 2001 From: Sylvain Brunato Date: Thu, 17 Sep 2026 17:01:29 +0200 Subject: [PATCH] fix(plugins): creodias and creodias_s3 auth errors handling --- docs/getting_started_guide/configure.rst | 7 ++----- docs/providers.rst | 3 +++ eodag/plugins/download/aws.py | 10 ++++++---- eodag/resources/providers/creodias.yml | 1 + tests/units/test_download_plugins.py | 3 +-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/getting_started_guide/configure.rst b/docs/getting_started_guide/configure.rst index 103a2ef5c2..6afdc3f53d 100644 --- a/docs/getting_started_guide/configure.rst +++ b/docs/getting_started_guide/configure.rst @@ -339,10 +339,6 @@ commands: .. code-block:: python - dag.providers_config["creodias"].auth.credentials["totp"] = "PLEASE_CHANGE_ME" - - # OR - dag.update_providers_config( """ creodias: @@ -357,7 +353,8 @@ will be stored and used if further authentication tries fail: .. code-block:: python - dag._plugins_manager.get_auth_plugin("creodias").authenticate() + eoproduct: eodag.EOProduct # EOProduct coming from a search result on creodias + eoproduct.downloader_auth.authenticate() Please note that authentication mechanism is already included in `download methods <../notebooks/api_user_guide/7_download.ipynb>`_ , so you could diff --git a/docs/providers.rst b/docs/providers.rst index 8ed57da15c..b19b6bf315 100644 --- a/docs/providers.rst +++ b/docs/providers.rst @@ -641,6 +641,9 @@ No credentials are needed `__ to see how to proceed. + Some collections, like CopDEM ones, require additional license agreement acceptance. Check them on your + `creodias personal profile / agreements section `__. + ---- **creodias_s3** diff --git a/eodag/plugins/download/aws.py b/eodag/plugins/download/aws.py index 54675f267e..23b1d61673 100644 --- a/eodag/plugins/download/aws.py +++ b/eodag/plugins/download/aws.py @@ -55,7 +55,6 @@ AuthenticationError, DownloadError, MisconfiguredError, - NoMatchingCollection, NotAvailableError, TimeOutError, ) @@ -672,12 +671,15 @@ def _get_unique_products( ) ) if not unique_product_chunks and raise_error: - raise NotAvailableError( - rf"No file basename matching re.fullmatch(r'{asset_filter}') was found in {product.remote_location}" + msg = ( + rf"No file basename matching re.fullmatch(r'{asset_filter}') was found in " + f"{product.remote_location}" ) + raise NotAvailableError(msg) if not unique_product_chunks and raise_error: - raise NoMatchingCollection("No product found to download.") + msg = f"No downloadable files found for {product}." + raise NotAvailableError(msg) return unique_product_chunks diff --git a/eodag/resources/providers/creodias.yml b/eodag/resources/providers/creodias.yml index 7c768d3994..a8acd3b4a6 100644 --- a/eodag/resources/providers/creodias.yml +++ b/eodag/resources/providers/creodias.yml @@ -246,6 +246,7 @@ creodias: type: HTTPDownload extract: true order_enabled: false + auth_error_code: [401, 403] archive_depth: 2 ssl_verify: true auth: diff --git a/tests/units/test_download_plugins.py b/tests/units/test_download_plugins.py index 0d758419c3..e4ed755354 100644 --- a/tests/units/test_download_plugins.py +++ b/tests/units/test_download_plugins.py @@ -35,7 +35,6 @@ from eodag.utils.exceptions import ( DownloadError, MisconfiguredError, - NoMatchingCollection, QuotaExceededError, ValidationError, ) @@ -2630,7 +2629,7 @@ def test_plugins_download_aws_no_matching_collection( plugin.config.products[self.product.collection]["build_safe"] = False plugin.config.flatten_top_dirs = True - with self.assertRaises(NoMatchingCollection): + with self.assertRaises(NotAvailableError): plugin.download(self.product, outputs_prefix=self.output_dir) @mock.patch(