Skip to content

Commit

Permalink
support optional_fields on getting meta data of probe / measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
itaru2622 committed Oct 2, 2023
1 parent 6d51e0c commit a3074b8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ripe/atlas/cousteau/api_meta_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ 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:
raise CousteauGenericError(
"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:
Expand All @@ -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(
Expand Down

0 comments on commit a3074b8

Please sign in to comment.