Skip to content

Commit b506a11

Browse files
issue #698 add fallback situations
1 parent 7440d71 commit b506a11

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

openeo/rest/connection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ def describe_process(self, id: str, namespace: Optional[str] = None) -> dict:
10681068

10691069
def get_schema_from_process_parameter(
10701070
self, process_id: str, parameter_id: str, namespace: Optional[str] = None
1071-
) -> dict:
1071+
) -> Union[dict, list]:
10721072
"""
10731073
Returns schema of the parameter of the process from the back end.
10741074
@@ -2123,6 +2123,4 @@ def search_list_for_dict_key(lst: list, key: str) -> Union[dict, list]:
21232123
result = item[key]
21242124
else:
21252125
raise OpenEoClientException("Multiple keys found with value {v}.".format(v=key))
2126-
if result is None:
2127-
raise OpenEoClientException("No dictionary found with the key {k}.".format(k=key))
21282126
return result

openeo/rest/datacube.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,8 +2724,13 @@ def sar_backscatter(
27242724
.. versionadded:: 0.4.9
27252725
.. versionchanged:: 0.4.10 replace `orthorectify` and `rtc` arguments with `coefficient`.
27262726
"""
2727-
schema = self.connection.get_schema_from_process_parameter("sar_backscatter", "coefficient")
2728-
coefficient_options = search_list_for_dict_key(schema, "enum")
2727+
if self.connection == None:
2728+
coefficient_options = [None]
2729+
else:
2730+
schema = self.connection.get_schema_from_process_parameter("sar_backscatter", "coefficient")
2731+
coefficient_options = search_list_for_dict_key(schema, "enum")
2732+
if coefficient_options is None:
2733+
coefficient_options = [None]
27292734
if coefficient not in coefficient_options:
27302735
raise OpenEoClientException("Invalid `sar_backscatter` coefficient {c!r}. Should be one of {o}".format(
27312736
c=coefficient, o=coefficient_options

0 commit comments

Comments
 (0)