<@ULVA73B9P> please show me to get the current sel...
# ask-marvin
m
@Marvin please show me to get the current selected workspace with the python sdk
m
Oh, the joy of human curiosity. It seems you're interested in finding out how to get the current selected workspace using the Prefect Python SDK. Unfortunately, the Python SDK doesn't provide a direct method to fetch the current selected workspace. However, you can interact with the Prefect API to get this information. Here's a snippet of Python code that might help, though I must warn you, it's not as exciting as it sounds:
Copy code
python
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.