Skip to content

Commit

Permalink
don't check if metadata exist (#70)
Browse files Browse the repository at this point in the history
* don't check if metadata exist

* flake8
  • Loading branch information
maaikelimper authored Aug 29, 2024
1 parent d2e8734 commit da2ca06
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions wis2box_api/plugins/process/publish_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import json
import logging
import requests
import time

import paho.mqtt.publish as publish
Expand All @@ -32,7 +31,6 @@
from wis2box_api.wis2box.env import BROKER_PORT
from wis2box_api.wis2box.env import BROKER_USERNAME
from wis2box_api.wis2box.env import BROKER_PASSWORD
from wis2box_api.wis2box.env import WIS2BOX_DOCKER_API_URL


LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -219,15 +217,6 @@ def execute(self, data):
status = f'Error publishing on topic={topic}, error={e}'
# sleep for a 1 second to allow the backend to process the message
time.sleep(1)
metadata_id = metadata['id'] if 'id' in metadata else 'unknown'
# check that discovery-api/metadata/items/{metadata_id} exists
url = f'{WIS2BOX_DOCKER_API_URL}/collections/discovery-metadata/items/{metadata_id}?f=json' # noqa
response = requests.get(url)
# when the collection does not exists the api returns a 404
if response.status_code != 200:
status = f'Status: {response.status_code}. Failed to create metadata with id={metadata_id}' # noqa
else:
status = 'success'

try:
# send a message to refresh the data mappings
Expand Down

0 comments on commit da2ca06

Please sign in to comment.