Aqib Fayyaz
11/14/2021, 6:04 PMimport requests
query = """
mutation {
create_flow_run(input: { flow_id: "9479ea34-f558-4616-8e64-50c7a508787d" }) {
id
}
}
"""
url = "<https://api.prefect.io>"
response = <http://requests.post|requests.post>(
url, json={"query": query}, headers={"authorization": "Bearer your-api-key"}
)
print(response.status_code)
print(response.text)
I am using above python code to invoke flow in prefect cloud, i have given the value of Api key and changed the flow_id as well but when i run this file i get the following error 200
{"errors":[{"path":["create_flow_run"],"message":"Unauthenticated","extensions":{"code":"UNAUTHENTICATED"}}],"data":{"create_flow_run":null}}Kevin Kho
Client().create_flow_run()
and see if that works?Aqib Fayyaz
11/14/2021, 6:08 PMKevin Kho
from prefect.client.client import Client
client = Client(api_key = ...)
client.create_flow_run(flow_id=...)
Docs hereAqib Fayyaz
11/14/2021, 6:20 PMAqib Fayyaz
11/14/2021, 6:22 PMval = client.create_flow_run(flow_id=...)
Kevin Kho
get_task_run_result
task that you can use. Just call the run
method.Aqib Fayyaz
11/14/2021, 9:15 PMlocation
so the result cannot be loaded. This often means that your task result has not been configured or has been configured incorrectlyAnna Geller
get_task_run_result
task. You can find more information incl. examples here: https://docs.prefect.io/core/concepts/results.html#results