Skip to content

Commit

Permalink
Change response signature to dicts for 'metadata_plus_exceptions' for…
Browse files Browse the repository at this point in the history
… internal consistency
  • Loading branch information
mwengren committed Dec 2, 2016
1 parent 1dd1cc2 commit 671f3bd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pyoos/collectors/ioos/swe_sos.py
Expand Up @@ -40,8 +40,9 @@ def metadata_plus_exceptions(self, output_format=None, feature_name_callback=Non
"""
Gets SensorML objects for all procedures in your filtered features.
Include any errors returned from SOS DescribeSensor request in a second return value
dictionary object
Return two dictionaries for service responses keyed by 'feature':
responses: values are SOS DescribeSensor response text
response_failures: values are exception text content furnished from ServiceException, ExceptionReport
You should override the default output_format for servers that do not
respond properly.
Expand All @@ -50,15 +51,15 @@ def metadata_plus_exceptions(self, output_format=None, feature_name_callback=Non
if output_format is None:
output_format = 'text/xml; subtype="sensorML/1.0.1/profiles/ioos_sos/1.0"'

responses = []
responses = {}
response_failures = {}
if self.features is not None:
for feature in self.features:
ds_kwargs = kwargs.copy()
ds_kwargs.update({'outputFormat': output_format,
'procedure' : callback(feature)})
try:
responses.append(SensorML(self.server.describe_sensor(**ds_kwargs)))
responses[feature] = (SensorML(self.server.describe_sensor(**ds_kwargs)))
except (ServiceException, ExceptionReport) as e:
response_failures[feature] = str(e)

Expand Down

0 comments on commit 671f3bd

Please sign in to comment.