Commit 3acc11bc authored by Manuel's avatar Manuel

roleStage: use-cases now get fetched from the server

parent b56119fa
......@@ -55,7 +55,30 @@ def _fetch_nodes(use_case: str, layer: Layer) -> List[Dict]:
return nodes
def fetch_nodes_from_semantic_linking(use_case: str):
def _fetch_use_cases() -> List[str]:
# fetch use-cases
jwt = TokenManager.getInstance().getToken()
url = f'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases'
response = requests.get(
url,
verify = False,
proxies = { "http":None, "https":None },
headers = {"Authorization": f"Bearer {jwt}"}
)
if response.status_code != 200:
raise ConnectionError(f"Could not fetch data from the server, statuscode: {response.status_code}!")
data = json.loads(response.text)
return [row["name"] for row in data]
def fetch_nodes_from_semantic_linking():
use_cases = _fetch_use_cases()
for use_case in use_cases:
# prune DB
repository = Repository()
repository.delete_all_layers()
......
......@@ -10,4 +10,4 @@ import processing.fetching.fetching as f
if __name__ == "__main__":
# TODO read use_case from somewhere
f.fetch_nodes_from_semantic_linking("smart-energy")
\ No newline at end of file
f.fetch_nodes_from_semantic_linking()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment