This is an automated email from the ASF dual-hosted git repository. skperez pushed a commit to branch SDAP-396 in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git
commit 257e4e22674e30a8ae552a2362fa4a948eb1c0e2 Author: skorper <[email protected]> AuthorDate: Tue Jul 19 23:23:26 2022 -0700 Added saildrone endpoint to insitu api call conf --- analysis/webservice/algorithms/doms/config.py | 12 +++++++++++- analysis/webservice/algorithms/doms/insitu.py | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/analysis/webservice/algorithms/doms/config.py b/analysis/webservice/algorithms/doms/config.py index 1119cf2..ed63860 100644 --- a/analysis/webservice/algorithms/doms/config.py +++ b/analysis/webservice/algorithms/doms/config.py @@ -36,6 +36,7 @@ INSITU_PROVIDER_MAP = [ }, { 'name': 'Saildrone', + 'endpoint': 'https://nasa-cdms.saildrone.com/1.0/query_data_doms_custom_pagination', 'projects': [ { 'name': '1021_atlantic', @@ -147,7 +148,16 @@ except KeyError: pass -def getEndpoint(): +def getEndpoint(provider_name=None): + if provider_name is None: + return INSITU_API_ENDPOINT + + provider = next((provider for provider in INSITU_PROVIDER_MAP + if provider['name'] == provider_name), None) + + if 'endpoint' in provider: + return provider['endpoint'] + return INSITU_API_ENDPOINT diff --git a/analysis/webservice/algorithms/doms/insitu.py b/analysis/webservice/algorithms/doms/insitu.py index 0344839..489ed1c 100644 --- a/analysis/webservice/algorithms/doms/insitu.py +++ b/analysis/webservice/algorithms/doms/insitu.py @@ -44,14 +44,15 @@ def query_insitu(dataset, variable, start_time, end_time, bbox, platform, depth_ insitu_response = {} # Page through all insitu results - next_page_url = insitu_endpoints.getEndpoint() + next_page_url = insitu_endpoints.getEndpoint(provider) while next_page_url is not None and next_page_url != 'NA': - logging.debug(f'Insitu request {next_page_url}') if session is not None: response = session.get(next_page_url, params=params) else: response = requests.get(next_page_url, params=params) + logging.debug(f'Insitu request {response.url}') + response.raise_for_status() insitu_page_response = response.json()
