Skip to content

Commit

Permalink
add expired flag to get all metatada
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollman committed Oct 23, 2023
1 parent 282786c commit ac134ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions caveclient/materializationengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,12 @@ def get_timestamp(self, version: int = None, datastack_name: str = None):
return convert_timestamp(meta["time_stamp"])

@cached(cache=TTLCache(maxsize=100, ttl=60 * 60 * 12))
def get_versions_metadata(self, datastack_name=None):
def get_versions_metadata(self, datastack_name=None, expired=False):
"""get the metadata for all the versions that are presently available and valid
Args:
datastack_name (str, optional): datastack to query. If None, defaults to the value set in the client.
expired (bool, optional): whether to include expired versions. Defaults to False.
Returns:
list[dict]: a list of metadata dictionaries
Expand All @@ -437,7 +438,8 @@ def get_versions_metadata(self, datastack_name=None):
endpoint_mapping = self.default_url_mapping
endpoint_mapping["datastack_name"] = datastack_name
url = self._endpoints["versions_metadata"].format_map(endpoint_mapping)
response = self.session.get(url)
query_args = {"expired": expired}
response = self.session.get(url, params=query_args)
d = handle_response(response)
for md in d:
md["time_stamp"] = convert_timestamp(md["time_stamp"])
Expand Down

0 comments on commit ac134ea

Please sign in to comment.