Skip to content

Commit

Permalink
ENH: Be more forgiving if a service property is not found since these…
Browse files Browse the repository at this point in the history
… are mainly for validation. [skip ci]
  • Loading branch information
Taher Chegini committed Sep 22, 2023
1 parent ce0d756 commit 4d45132
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pygeoogc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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, ...]]:
Expand Down

0 comments on commit 4d45132

Please sign in to comment.