From 3776868a906491c2e6a6c3a48dfd85d942f496f8 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Fri, 8 Mar 2024 13:42:27 -0300 Subject: [PATCH] allow for empty dataset_id info URL --- erddapy/core/url.py | 7 +++---- erddapy/erddapy.py | 7 ++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/erddapy/core/url.py b/erddapy/core/url.py index 4f9ee31..7acec64 100644 --- a/erddapy/core/url.py +++ b/erddapy/core/url.py @@ -343,6 +343,7 @@ def get_info_url( ---- server: data server endpoint. dataset_id: a dataset unique id. + If empty the full dataset listing will be returned. response: default is HTML. Returns: @@ -350,10 +351,8 @@ def get_info_url( url: the info URL for the `response` chosen. """ - if not dataset_id: - msg = f"You must specify a valid dataset_id, got {dataset_id}" - raise ValueError(msg) - + if dataset_id is None: + return f"{server}/info/index.{response}?itemsPerPage=1000000" return f"{server}/info/{dataset_id}/index.{response}" diff --git a/erddapy/erddapy.py b/erddapy/erddapy.py index e0d86a0..818d418 100644 --- a/erddapy/erddapy.py +++ b/erddapy/erddapy.py @@ -263,6 +263,7 @@ def get_info_url( Args: ---- dataset_id: a dataset unique id. + If empty the full dataset listing will be returned. response: default is HTML. Returns: @@ -273,7 +274,11 @@ def get_info_url( dataset_id = dataset_id if dataset_id else self.dataset_id response = response if response else self.response - return get_info_url(self.server, dataset_id, response) + return get_info_url( + self.server, + dataset_id=dataset_id, + response=response, + ) def get_categorize_url( self: ERDDAP,