Loading app/app_template.py +6 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,10 @@ user_name = os.getenv("USER_NAME", "test") @app.get("/onboard") def onboard(): response_message = "Onboard" ### Create the connection with CAPIF and set the invoker's config file ### Initialize invoker object # invoker = opencapif_sdk.capif_invoker_connector(config_file="invoker_sdk_config.json") ### Onboard the invoker ### Onboard the invoker (create keys, get token for onboarding, onboard, store info to file) # invoker.onboard_invoker() ### Uncomment to get the Invoker ID Loading @@ -39,7 +39,7 @@ def onboard(): @app.get("/discover") def discover(): response_message = "Discover" ### Create the connection with CAPIF as an onboarded invoker ### Initialize discoverer object and set discover filters # service_discoverer = opencapif_sdk.service_discoverer(config_file="invoker_sdk_config.json") ### Discover APIs according to the filters Loading Loading @@ -73,12 +73,13 @@ def access_service(): # service_discoverer = pickle.load(f) ### Fetch the necessary information of the targeted API and add to a url parameter # service_path = service_discoverer.retrieve_specific_resource_name(api_name, resource_name).split("/")[-1] ### "retrieve_specific_resource_name" returns: "api_name / version / uri" # service_path = "/".join(service_discoverer.retrieve_specific_resource_name(api_name, resource_name).split("/")[2:]) # api_details = service_discoverer.retrieve_api_description_by_name(api_name) # service_interface = api_details["aefProfiles"][0]['interfaceDescriptions'][0] # url = "http://{}:{}/{}".format(service_interface['ipv4Addr'], service_interface['port'], service_path) ### Get API token for the discovered API ### Create security context and get token for all discovered APIs # service_discoverer.get_tokens() # jwt_token = service_discoverer.token Loading Loading
app/app_template.py +6 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,10 @@ user_name = os.getenv("USER_NAME", "test") @app.get("/onboard") def onboard(): response_message = "Onboard" ### Create the connection with CAPIF and set the invoker's config file ### Initialize invoker object # invoker = opencapif_sdk.capif_invoker_connector(config_file="invoker_sdk_config.json") ### Onboard the invoker ### Onboard the invoker (create keys, get token for onboarding, onboard, store info to file) # invoker.onboard_invoker() ### Uncomment to get the Invoker ID Loading @@ -39,7 +39,7 @@ def onboard(): @app.get("/discover") def discover(): response_message = "Discover" ### Create the connection with CAPIF as an onboarded invoker ### Initialize discoverer object and set discover filters # service_discoverer = opencapif_sdk.service_discoverer(config_file="invoker_sdk_config.json") ### Discover APIs according to the filters Loading Loading @@ -73,12 +73,13 @@ def access_service(): # service_discoverer = pickle.load(f) ### Fetch the necessary information of the targeted API and add to a url parameter # service_path = service_discoverer.retrieve_specific_resource_name(api_name, resource_name).split("/")[-1] ### "retrieve_specific_resource_name" returns: "api_name / version / uri" # service_path = "/".join(service_discoverer.retrieve_specific_resource_name(api_name, resource_name).split("/")[2:]) # api_details = service_discoverer.retrieve_api_description_by_name(api_name) # service_interface = api_details["aefProfiles"][0]['interfaceDescriptions'][0] # url = "http://{}:{}/{}".format(service_interface['ipv4Addr'], service_interface['port'], service_path) ### Get API token for the discovered API ### Create security context and get token for all discovered APIs # service_discoverer.get_tokens() # jwt_token = service_discoverer.token Loading