Tao Bian
12/15/2021, 4:56 PMfrom prefect.client.client import Client
client = Client()
client.graphql(query)
Anna Geller
import requests
query = """
mutation {
create_flow_run(input: { version_group_id: "fb919cc4-7f74-4ed7-9f3c-71bdd9be69e8" }) {
id
}
}
"""
url = "<https://api.prefect.io>"
response = <http://requests.post|requests.post>(
url, json={"query": query}, headers={"authorization": "Bearer XXX"}
)
print(response.status_code)
print(response.text)
Kevin Kho
prefect auth login --key API_KEY
, then the Client will pull that API key. You can also pass it into the Client()
. You can use client.create_flow_run()
instead of the client.graphql()
. You can also use create_flow_run
in our task library which is much more flexible. Just invoke it by calling .run()
create_flow_run.run(flow_name="name", project_name="project")
Tao Bian
12/15/2021, 6:33 PM