diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bb2cd0..3ba673f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,8 +28,11 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ------ ## [1.0.8](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.7...v1.0.8) ### Changed -- bump asf-search to v10.0.1 for NISAR `GUNW` and `GSLC` `processingLevel` search keyword collection aliases, and ARIA-S1 GUNW Stacking support - - also adds NISAR file size export support +- bump asf-search to v10.0.2 for NISAR product type file sizes, urgent response now searchable with product types, and ARIA-S1 GUNW Stacking support + +### Fixed +- boolean values are properly capitalized in `python` output file + ------ ## [1.0.7](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.6...v1.0.7) ### Changed diff --git a/requirements.txt b/requirements.txt index 90fd7a6..277371a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ ujson==5.7.0 uvicorn==0.21.1 watchfiles==0.19.0 -asf-search[asf-enumeration]==10.0.1 +asf-search[asf-enumeration]==10.0.2 python-json-logger==2.0.7 pyshp==2.1.3 diff --git a/src/SearchAPI/application/application.py b/src/SearchAPI/application/application.py index c95e6d6..2e88347 100644 --- a/src/SearchAPI/application/application.py +++ b/src/SearchAPI/application/application.py @@ -1,3 +1,4 @@ +from datetime import datetime import json import os @@ -6,7 +7,7 @@ import asf_search as asf from fastapi import Depends, FastAPI, Request, HTTPException, APIRouter, UploadFile -from fastapi.responses import Response, JSONResponse +from fastapi.responses import RedirectResponse, Response, JSONResponse from fastapi.middleware.cors import CORSMiddleware from .log_router import LoggingRoute @@ -227,6 +228,31 @@ async def file_to_wkt(files: list[UploadFile]): headers=constants.DEFAULT_HEADERS ) +# @router.get('/redirect/{shortName}') +# async def nisar_static_layer(shortName: str, granule_id: str, cmr_token: Optional[str], cmr_host: Optional[str]='uat'): +# opts = asf.ASFSearchOptions() +# if cmr_token is not None: +# if cmr_host == 'uat': +# host = asf.INTERNAL.CMR_HOST_UAT +# else: +# host = asf.INTERNAL.CMR_HOST +# session = asf.ASFSession(cmr_host=host).auth_with_token(cmr_token) +# opts.session = session +# opts.host = host +# try: +# granule = asf.search( +# granule_list=[granule_id], +# opts=opts +# )[0] +# except IndexError: +# raise HTTPException(status_code=400, detail=f'Unable to find static layer, provided scene named "{granule_id}" not found in CMR record') + +# static_layer = granule.get_static_layer(opts=asf.ASFSearchOptions(shortName=shortName)) +# if static_layer is None: +# raise HTTPException(status_code=500, detail=f'Static layer not found for scene named "{granule_id}"') + +# return RedirectResponse(static_layer.properties['url']) + def validate_wkt(wkt: str): try: diff --git a/src/SearchAPI/application/output.py b/src/SearchAPI/application/output.py index 37d3c39..fdd6b3b 100644 --- a/src/SearchAPI/application/output.py +++ b/src/SearchAPI/application/output.py @@ -175,12 +175,14 @@ def get_asf_search_script( ) -> tuple[str, str]: opts.session = None + # ASFSearchOptions formatting uses json.dumps for serialization. Add proper python capitalization + opts_str = str(opts).replace('true', 'True', -1).replace('false', 'False') if search_endpoint == 'param': file_name=make_filename('py', prefix='asf-search-script') - output_script = asf_search_script_template.format(file_name, str(opts)) + output_script = asf_search_script_template.format(file_name, opts_str) else: file_name=make_filename('py', prefix='asf-search-baseline-script') - output_script = asf_search_baseline_script_template.format(file_name, reference, str(opts)) + output_script = asf_search_baseline_script_template.format(file_name, reference, opts_str) return file_name, output_script def make_filename(suffix, prefix:str = 'asf-results'):