Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi Team,
I have a requirement where I need to run a DSS scenario via Endpoint url and I have tried multiple ways to approach this but the issue seems to be while creating a client object.
Received the following error for point 2 and 3:
It would be really helpful if you can provide a solution for this. Any help is appreciated, Thankyou.
Code for your reference:
import dataiku
import dataikuapi
import pandas as pd, numpy as np
#dataiku.set_remote_dss("http://http(s)://IP:16000/", "personal_api_secret_key")
def do_something(param):
try:
client = dataikuapi.DSSClient("http://http(s)://IP:16000", "personal_api_secret_key")
#client = dataiku.api_client()
project = client.get_project('project_name')
variables = project.get_variables()
variables["standard"]["param"] = param
project.set_variables(variables)
scenario = project.get_scenario('scenario_name')
trigger_fire = scenario.run()
scenario_run = trigger_fire.wait_for_scenario_run()
scenario_run.wait_for_completion()
if not scenario_run.running:
last_runs = scenario.get_last_runs(only_finished_runs=True)
if last_runs[0].outcome == 'SUCCESS':
val = 'SUCESS'
except Exception as e:
val = str(e)
finally:
return val
Hi,
The URL you passed to instantiate the client object seems to be malformed. For example, if your instance lives at https://example.com, the client object should be created as follows:
client = dataikuapi.DSSClient("https://example.com", "personal_api_secret_key")
If you usually access your instance directly via its IPv4 public address, then you should specify which port you are targeting, for example if the IP is 1.2.3.4 and the port is 16000:
client = dataikuapi.DSSClient("http://1.2.3.4:16000", "personal_api_secret_key")
Hope this helps.
Best,
Harizo
Hi @HarizoR ,
Thankyou for you reply.
I tried both the URLs (http and http(s)) but got error in both:
Result: Invalid URL 'http(s)://1.2.3.4:16000/dip/publicapi/projects/PROJECT_NAME/variables/': No schema supplied. Perhaps you meant http://http(s)://1.2.3.4:16000/dip/publicapi/projects/PROJECT_NAME/variables/?
Could you please tell me if I am missing any step here?
Also, Is the method of generating API Id and secret key correct? Profile -> APIKey -> New Key -> id & secret key.
Thankyou
Hi,
In a standard URL you specify either http or https, you can't have both at the same time. In practice, it means that a URL beginning with http://http(s):// is not valid. To make sure that you are using the correct URL to reach your DSS instance, please refer to the content of your browser's navigation bar when you visit it. Don't hesitate to ask the administrator of your DSS instance if you have further doubts.
As for the key generation process, I confirm that it is the correct one to create personal API keys.
Best,
Harizo