diff --git a/openeo/rest/connection.py b/openeo/rest/connection.py index 0b9d024ca..e36379c96 100644 --- a/openeo/rest/connection.py +++ b/openeo/rest/connection.py @@ -640,10 +640,12 @@ def describe_account(self) -> str: def user_jobs(self) -> dict: return self.list_jobs() - def list_collections(self) -> List[dict]: + def list_collections(self, pattern: Optional[str] = None) -> List[dict]: """ List basic metadata of all collections provided by the back-end. + :param pattern: a pattern that matches the collections of interest, e.g. "sentinel" + .. caution:: Only the basic collection metadata will be returned. @@ -653,6 +655,10 @@ def list_collections(self) -> List[dict]: :return: list of dictionaries with basic collection metadata. """ data = self.get('/collections', expected_status=200).json()["collections"] + + if pattern is not None: + data = [collection for collection in data if 'id' in collection and pattern in collection['id']] + return VisualList("collections", data=data) def list_collection_ids(self) -> List[str]: