From 3a0a40f9481250025ec71e9dc9d71892ec3f5ff8 Mon Sep 17 00:00:00 2001 From: anikaweinmann Date: Tue, 23 Nov 2021 13:29:50 +0100 Subject: [PATCH] use URL_PREFIX from actinia_core app --- .../ephemeral_landsat_ndvi_processor.py | 11 ++++++----- .../ephemeral_sentinel2_ndvi_processor.py | 15 ++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/actinia_satellite_plugin/ephemeral_landsat_ndvi_processor.py b/src/actinia_satellite_plugin/ephemeral_landsat_ndvi_processor.py index 3b5bcbf..339dbcc 100644 --- a/src/actinia_satellite_plugin/ephemeral_landsat_ndvi_processor.py +++ b/src/actinia_satellite_plugin/ephemeral_landsat_ndvi_processor.py @@ -15,6 +15,7 @@ from actinia_core.models.response_models import UnivarResultModel, ProcessingResponseModel from actinia_core.core.common.landsat_processing_library import LandsatProcessing from actinia_core.models.response_models import ProcessingErrorResponseModel +from actinia_core.core.common.app import URL_PREFIX __license__ = "GPLv3" __author__ = "Sören Gebbert" @@ -54,8 +55,8 @@ class LandsatNDVIResponseModel(ProcessingResponseModel): "api_info": { "endpoint": "asyncephemerallandsatprocessingresource", "method": "POST", - "path": "/api/v1/landsat_process/LC80440342016259LGN00/TOAR/NDVI", - "request_url": "http://localhost:5000/api/v1/landsat_process/LC80440342016259LGN00/TOAR/NDVI" + "path": f"{URL_PREFIX}/landsat_process/LC80440342016259LGN00/TOAR/NDVI", + "request_url": f"http://localhost:5000{URL_PREFIX}/landsat_process/LC80440342016259LGN00/TOAR/NDVI" }, "datetime": "2018-05-30 11:22:58.315162", "http_code": 200, @@ -635,10 +636,10 @@ class LandsatNDVIResponseModel(ProcessingResponseModel): "timestamp": 1527679378.31516, "urls": { "resources": [ - "http://localhost:5000/api/v1/resource/superadmin/resource_id-6282c634-42e1-417c-a092-c9b21c3283cc/tmp80apvh0h.png", - "http://localhost:5000/api/v1/resource/superadmin/resource_id-6282c634-42e1-417c-a092-c9b21c3283cc/LC80440342016259LGN00_TOAR_NDVI.tiff" + f"http://localhost:5000{URL_PREFIX}/resource/superadmin/resource_id-6282c634-42e1-417c-a092-c9b21c3283cc/tmp80apvh0h.png", + f"http://localhost:5000{URL_PREFIX}/resource/superadmin/resource_id-6282c634-42e1-417c-a092-c9b21c3283cc/LC80440342016259LGN00_TOAR_NDVI.tiff" ], - "status": "http://localhost:5000/api/v1/resources/superadmin/resource_id-6282c634-42e1-417c-a092-c9b21c3283cc" + "status": f"http://localhost:5000{URL_PREFIX}/resources/superadmin/resource_id-6282c634-42e1-417c-a092-c9b21c3283cc" }, "user_id": "superadmin" } diff --git a/src/actinia_satellite_plugin/ephemeral_sentinel2_ndvi_processor.py b/src/actinia_satellite_plugin/ephemeral_sentinel2_ndvi_processor.py index ae35854..31a8333 100644 --- a/src/actinia_satellite_plugin/ephemeral_sentinel2_ndvi_processor.py +++ b/src/actinia_satellite_plugin/ephemeral_sentinel2_ndvi_processor.py @@ -16,6 +16,7 @@ from actinia_core.core.common.app import auth from actinia_core.core.common.api_logger import log_api_call from actinia_core.models.response_models import ProcessingErrorResponseModel +from actinia_core.core.common.app import URL_PREFIX __license__ = "GPLv3" __author__ = "Sören Gebbert" @@ -30,19 +31,19 @@ class SentinelNDVIResponseModel(ProcessingResponseModel): It is used as schema to define the *process_result* in a ProcessingResponseModel derivative. """ type = 'object' - properties = deepcopy(ProcessingResponseModel.properties) + properties = deepcopy(ProcessingResponseModel.properties) properties["process_results"] = {} properties["process_results"]["type"] = "array" properties["process_results"]["items"] = UnivarResultModel - required = deepcopy(ProcessingResponseModel.required) + required = deepcopy(ProcessingResponseModel.required) example = { "accept_datetime": "2018-05-30 12:25:43.987713", "accept_timestamp": 1527683143.9877105, "api_info": { "endpoint": "asyncephemeralsentinel2processingresource", "method": "POST", - "path": "/api/v1/sentinel2_process/ndvi/S2A_MSIL1C_20161206T030112_N0204_R032_T50RKR_20161206T030749", - "request_url": "http://localhost:8080/api/v1/sentinel2_process/ndvi/S2A_MSIL1C_20161206T030112_N0204_R032_T50RKR_20161206T030749" + "path": f"{URL_PREFIX}/sentinel2_process/ndvi/S2A_MSIL1C_20161206T030112_N0204_R032_T50RKR_20161206T030749", + "request_url": f"http://localhost:8080{URL_PREFIX}/sentinel2_process/ndvi/S2A_MSIL1C_20161206T030112_N0204_R032_T50RKR_20161206T030749" }, "datetime": "2018-05-30 12:29:11.800608", "http_code": 200, @@ -617,10 +618,10 @@ class SentinelNDVIResponseModel(ProcessingResponseModel): "timestamp": 1527683351.8002071, "urls": { "resources": [ - "http://localhost:8080/api/v1/resource/superadmin/resource_id-6b849585-576f-40b5-a514-34a7cf1f97ce/tmpsaeegg0q.png", - "http://localhost:8080/api/v1/resource/superadmin/resource_id-6b849585-576f-40b5-a514-34a7cf1f97ce/ndvi.tiff" + f"http://localhost:8080{URL_PREFIX}/resource/superadmin/resource_id-6b849585-576f-40b5-a514-34a7cf1f97ce/tmpsaeegg0q.png", + f"http://localhost:8080{URL_PREFIX}/resource/superadmin/resource_id-6b849585-576f-40b5-a514-34a7cf1f97ce/ndvi.tiff" ], - "status": "http://localhost:8080/api/v1/resources/superadmin/resource_id-6b849585-576f-40b5-a514-34a7cf1f97ce" + "status": f"http://localhost:8080{URL_PREFIX}/resources/superadmin/resource_id-6b849585-576f-40b5-a514-34a7cf1f97ce" }, "user_id": "superadmin" }