Hugo Kitano
06/14/2021, 6:46 PMKevin Kho
create_flow_run
endpoint of the GraphQL APIKevin Kho
import requests
import json
query = """mutation {
create_flow_run(input: {
flow_id: "5ac80adc-442a-4e53-bc01-d9d65bffd6aa"}) {
id
}
}"""
url = '<https://api.prefect.io>'
r = <http://requests.post|requests.post>(url, json={'query': query}, headers={"authorization": "Bearer insert_token"})
print(r.status_code)
print(r.text)
Kevin Kho
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"}
Kevin Kho
Prefect Client
has a create_flow_run
method that you can use. I gave the script above first cuz there’s no Prefect dependencyHugo Kitano
06/14/2021, 6:53 PMKevin Kho
from prefect.client.client import Client
Client=Client()
Client.create_flow_run(flow_id=id, run_name="test")
Hugo Kitano
06/14/2021, 6:55 PMKevin Kho
Kevin Kho
prefect auth login
on the CLI, then the Client would be able to fetch itHugo Kitano
06/14/2021, 7:59 PMKevin Kho
Hugo Kitano
06/14/2021, 8:11 PMKevin Kho
Hugo Kitano
06/14/2021, 8:18 PMKevin Kho
Hugo Kitano
06/14/2021, 8:19 PMHugo Kitano
06/14/2021, 8:20 PMMariia Kerimova
06/14/2021, 8:36 PMPREFECT__CLOUD__AUTH_TOKEN
for authenticating your client.Hugo Kitano
06/14/2021, 8:37 PMMariia Kerimova
06/14/2021, 8:56 PMHugo Kitano
06/14/2021, 8:59 PMPREFECT_CLOUD_AUTH_TOKEN
, I should use the ID token returned after I do prefect auth list-tokens
, right?Mariia Kerimova
06/14/2021, 9:12 PMmutation {
create_api_key(input: { user_id: <user_id>, name: "my-api-key" }) {
token
}
}
Mariia Kerimova
06/14/2021, 9:14 PMprefect auth list-tokens