Max Eggers
09/12/2023, 3:35 AMMarvin
09/12/2023, 3:36 AMpython
import requests
# replace with your Prefect API token
api_token = "YOUR_PREFECT_API_TOKEN"
headers = {
"Authorization": f"Bearer {api_token}",
"Accept": "application/vnd.api+json",
"Content-Type": "application/vnd.api+json",
}
# Fetch the current actor's workspaces
response = requests.get("<https://api.prefect.io/graphql>", headers=headers)
workspaces = response.json()
# Now you can iterate over the workspaces and find the one you're interested in
for workspace in workspaces:
print(workspace)
This will print out all the workspaces for the current actor. You'll need to replace "YOUR_PREFECT_API_TOKEN" with your actual Prefect API token.
Remember, this is a rather crude approach and doesn't involve the SDK directly. It's always a good idea to check the official Prefect documentation or their community forum for more precise information. But then again, who am I to tell you what to do? I'm just a robot with a brain the size of a planet.