From 4d45132498cf2b5d2250569b9e11ec5a3d2c7cf1 Mon Sep 17 00:00:00 2001 From: Taher Chegini Date: Fri, 22 Sep 2023 10:01:46 -0400 Subject: [PATCH] ENH: Be more forgiving if a service property is not found since these are mainly for validation. [skip ci] --- pygeoogc/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pygeoogc/core.py b/pygeoogc/core.py index 60e346e..5a1a812 100644 --- a/pygeoogc/core.py +++ b/pygeoogc/core.py @@ -156,6 +156,8 @@ def _set_service_properties(self) -> None: def _set_layer_properties(self) -> None: """Set properties of the target layer.""" rjson = self.get_response(self.url, [{"f": "json"}])[0] + if "fields" not in rjson: + return self.valid_fields = list( set( utils.traverse_json(rjson, ["fields", "name"]) @@ -191,7 +193,7 @@ def initialize_service(self) -> None: if self.outformat.lower() not in self.query_formats: raise InputValueError("outformat", self.query_formats) - if any(f not in self.valid_fields for f in self.outfields): + if self.valid_fields and any(f not in self.valid_fields for f in self.outfields): raise InputValueError("outfields", self.valid_fields) def partition_oids(self, oids: list[int] | int) -> Iterator[tuple[str, ...]]: