From 648675425ecaf3d2ba4ed76ef274a0124feafb2e Mon Sep 17 00:00:00 2001 From: Marcel Nijenhof Date: Mon, 16 Mar 2020 12:40:58 +0100 Subject: [PATCH] Fix issue 8: Aspect set matroos is nu een lege dict --- ddapioper.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ddapioper.py b/ddapioper.py index 617ab6a..253c960 100644 --- a/ddapioper.py +++ b/ddapioper.py @@ -233,9 +233,14 @@ Returns the results part of the response. def aspectSet(self): """aspectSet() -Returns the metadata of the aspectSet +Returns the metadata of the aspectSet. + +Note: Return a empty dict if there is no aspectset (matroos) """ - return(self.result()["observationType"]["aspectSet"]["aspects"]) + observationType = self.result().get("observationType", {}) + aspectSet = observationType.get("aspectSet", {}) + aspects = aspectSet.get("aspects", {}) + return(aspects) def location(self): """location()