Commit 3df25b97 authored by BODERE's avatar BODERE
Browse files

fix: rename method

parent bf535688
......@@ -4,8 +4,8 @@ from opensearx_ws.opensearch import IfremerOpensearchEngine, NasaOpensearchEngin
opensearch_engines = {
"Ifremer": IfremerOpensearchEngine(root_path='https://opensearch.ifremer.fr/granules.atom', timeout=30.0),
"TimeoutFailed": IfremerOpensearchEngine(root_path='https://opensearch.ifremer.fr/granules.atom', timeout=2.0),
"TimeoutFailed": IfremerOpensearchEngine(root_path='https://opensearch.ifremer.fr/granules.atom', timeout=1.0),
"NotExistingURL": IfremerOpensearchEngine(root_path='https://toto.ifremer.fr/granules.atom', timeout=2.0),
"NasaURL": NasaOpensearchEngine(root_path='https://cmr.earthdata.nasa.gov/opensearch/granules.atom', timeout=30.0)
"Nasa": NasaOpensearchEngine(root_path='https://cmr.earthdata.nasa.gov/opensearch/granules.atom', timeout=30.0)
}
......@@ -101,12 +101,12 @@ class OpensearchEngine:
def _build_search_url(self, params: OpensearchQueryParameters) -> str:
scheme, netloc, path, query_string, fragment = urlsplit(self.root_path)
query_params = parse_qs(query_string)
for k, v in self._params_as_dict(params).items():
for k, v in self._prepare_query_parameters(params).items():
query_params[k] = v
new_query_string = urlencode(query_params, doseq=False, quote_via=quote)
return urlunsplit((scheme, netloc, path, new_query_string, fragment))
def _params_as_dict(self, params: OpensearchQueryParameters) -> Dict:
def _prepare_query_parameters(self, params: OpensearchQueryParameters) -> Dict:
return {
"datasetId": params.datasetId,
"timeStart": params.timeStart.strftime("%Y-%m-%dT%H:%M:%SZ"),
......@@ -199,7 +199,7 @@ class IfremerOpensearchEngine(OpensearchAtomEngine):
class NasaOpensearchEngine(OpensearchAtomEngine):
def _params_as_dict(self, params: OpensearchQueryParameters) -> Dict:
def _prepare_query_parameters(self, params: OpensearchQueryParameters) -> Dict:
return {
"parentIdentifier": params.datasetId,
"startTime": params.timeStart.strftime("%Y-%m-%dT%H:%M:%SZ"),
......@@ -218,7 +218,6 @@ class NasaOpensearchEngine(OpensearchAtomEngine):
summary=self.get_text(entry, "feed:summary"),
dc_date=self.get_text(entry, "dc:date"),
geobox=self.get_text(entry, "georss:box"),
# geobox_where=self.get_text(entry, "geobox_where")
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment