Skip to content

Commit

Permalink
moving post_stac_item to stac_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
dchandan committed Aug 24, 2023
1 parent ca45cc3 commit 6e500d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions STACpopulator/populator_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from STACpopulator.stac_utils import (
create_stac_collection,
post_collection,
post_stac_item,
stac_collection_exists,
stac_host_reachable,
url_validate,
Expand Down Expand Up @@ -95,7 +96,7 @@ def ingest(self) -> None:
LOGGER.info(f"Creating STAC representation for {item_name}")
stac_item = self.create_stac_item(item_name, item_data)
if self.validate_stac_item_cv(stac_item):
if self.post_item(stac_item):
if post_stac_item(self.stac_host, self.collection_id, stac_item):
LOGGER.info(f"{item_name} successfully posted")
else:
LOGGER.error(f"Posting {item_name} failed")
Expand All @@ -104,9 +105,6 @@ def ingest(self) -> None:
LOGGER.error(f"Validation failed for item {item_name}")
self.handle_ingestion_error("Validation Error", item_name, item_data)

def post_item(self, data: dict[str, dict]) -> bool:
pass

@abstractmethod
def handle_ingestion_error(self, error: str, item_name: str, item_data: MutableMapping[str, Any]):
pass
Expand Down
4 changes: 4 additions & 0 deletions STACpopulator/stac_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,7 @@ def post_collection(stac_host: str, json_data: dict[str, Any]) -> None:
r.raise_for_status()
else:
r.raise_for_status()


def post_stac_item(stac_host: str, collection_id: str, data: dict[str, dict]) -> bool:
pass

0 comments on commit 6e500d8

Please sign in to comment.