Install the Xanadu Cloud Computing Python library:
pip install git+https://github.com/XanaduAI/xanadu-cloud-client.git
The Python code below is an example on how to connect to the DTU Qcloud API. It executes a program on DASQ simulator.
The program needs an API key. To get this, login to qcloud.dtu.dk, click on top-right user picture and select "Get API Key". The API key is a string like 6sTycTkL-HbIA8Ohauhu2vOUz-L28a7HDJfmnMCOgxsmH and must be provided to the refresh_token argument in the Connection call.
import xcc
import json
connection = xcc.Connection(host="qcloud.dtu.dk", refresh_token="<API key>")
print( xcc.Device.list(connection=connection) )
language = "json_dict:1.0"
circuit_dict = {
'kensingtonian_m': 4
}
job = xcc.Job.submit(
connection,
name="dasq_simulator_example",
target="dasq_simulator",
circuit=json.dumps(circuit_dict),
language=language)
job.wait()
print( job.status )
print( job.finished )
print( job.result )