From a3074b83ca4319d66201923ef8751960ec6d723f Mon Sep 17 00:00:00 2001 From: itaru2622 Date: Mon, 2 Oct 2023 09:04:06 +0900 Subject: [PATCH] support optional_fields on getting meta data of probe / measurement --- ripe/atlas/cousteau/api_meta_data.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ripe/atlas/cousteau/api_meta_data.py b/ripe/atlas/cousteau/api_meta_data.py index 58faf63..4d5e21d 100644 --- a/ripe/atlas/cousteau/api_meta_data.py +++ b/ripe/atlas/cousteau/api_meta_data.py @@ -35,6 +35,7 @@ def __init__(self, **kwargs): self.meta_data = kwargs.get("meta_data") self._user_agent = kwargs.get("user_agent") self._fields = kwargs.get("fields") + self._optional_fields = kwargs.get("optional_fields") self.get_params = {} if self.meta_data is None and self.id is None: @@ -42,7 +43,7 @@ def __init__(self, **kwargs): "Id or meta_data should be passed in order to create object." ) - if self._fields: + if self._fields or self._optional_fields: self.update_get_params() if self.meta_data is None: @@ -58,6 +59,11 @@ def update_get_params(self): elif isinstance(self._fields, str): self.get_params["fields"] = self._fields + if isinstance(self._optional_fields, (tuple, list)): # tuples & lists > x,y,z + self.get_params["optional_fields"] = ",".join([str(_) for _ in self._optional_fields]) + elif isinstance(self._optional_fields, str): + self.get_params["optional_fields"] = self._optional_fields + def _fetch_meta_data(self): """Makes an API call to fetch meta data for the given probe and stores the raw data.""" is_success, meta_data = AtlasRequest(