diff --git a/fx_python_sdk_cli/consumer.py b/fx_python_sdk_cli/consumer.py index 87328d6..7433fee 100644 --- a/fx_python_sdk_cli/consumer.py +++ b/fx_python_sdk_cli/consumer.py @@ -4,11 +4,15 @@ import base64 # in python import yaml # MIT import json +import os from .utils import get_data_offer, offer2et, create_poc_ContractRequest_body, str_edc_catalog +current_dir = os.path.dirname(os.path.abspath(__file__)) +yaml_file_path = os.path.join(current_dir, 'consumer_cfg.yaml') + # --- variables --- -with open('consumer_cfg.yaml', 'r') as file: +with open(yaml_file_path, 'r') as file: consumer_cfg = yaml.safe_load(file) # - control plane - @@ -24,7 +28,7 @@ def get_edrs_for_object(object_of_agreement): # see if there are some edrs which have been negotiated for # Load the JSON from the file - with open('agreement_body.json', 'r') as f: + with open(os.path.join(current_dir, 'agreement_body.json'), 'r') as f: loaded_agreement_body = json.load(f) # Replace the placeholder with the actual object of agreement @@ -57,7 +61,7 @@ def get_data(et_dict): def request_assets_from_provider(): # obtain all offers from the data provider using a catalog request: # Load the JSON from the file - with open('catalog_request_body', 'r') as f: + with open(os.path.join(current_dir, 'catalog_request_body'), 'r') as f: loaded_catalog_request_body = json.load(f) # Replace the placeholders with actual values loaded_catalog_request_body["counterPartyId"] = edc_provider_bpn diff --git a/fx_python_sdk_cli/provider.py b/fx_python_sdk_cli/provider.py index cb3254d..f907460 100644 --- a/fx_python_sdk_cli/provider.py +++ b/fx_python_sdk_cli/provider.py @@ -4,11 +4,15 @@ import uuid import base64 # in python import yaml # MIT +import os from .utils import make_create_secure_asset_body, create_generic_Access_PolicyDefinitionRequest_body, create_generic_Usage_PolicyDefinitionRequest_body, create_generic_ContractDefinitionRequest_body, print_edc_assets +current_dir = os.path.dirname(os.path.abspath(__file__)) +yaml_file_path = os.path.join(current_dir, 'provider_cfg.yaml') + # --- variables --- -with open('provider_cfg.yaml', 'r') as file: +with open(yaml_file_path, 'r') as file: provider_cfg = yaml.safe_load(file) # - control plane - diff --git a/setup.py b/setup.py index 28b0d52..9460bda 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="fx-python-sdk-cli", - version="0.1.2", + version="0.1.3", author="FX", author_email="fx@fx.com", description="Interact with FX Port to share / retrieve AAS Submodel",