https://prefect.io logo
Title
p

Peter

03/06/2023, 6:16 PM
Any chance I can grab account and workspace_id out of a python object easily? I'm doing error flows and I want to dynamically build the cloud url in every workspace without adding new configuration
1
z

Zanie

03/06/2023, 6:28 PM
What Python object do you mean?
p

Peter

03/06/2023, 6:28 PM
any python object... is there an execution context or something passed in?
z

Zanie

03/06/2023, 6:29 PM
PREFECT_API_URL
has your account and workspace id in it
PREFECT_UI_URL
will get you the URL for the UI with similar context
🙌 1
p

Peter

03/06/2023, 6:31 PM
Thanks Zanie!
z

Zanie

03/06/2023, 6:32 PM
np, these are available at
prefect.settings
and require you to call
.value()
to get the actual value instead of the setting object.
p

Peter

03/06/2023, 6:38 PM
So settings.PREFECT_UI_URL.value() should spit out: https://app.prefect.cloud/account/account_UUID/workspace/workspace_UUID
z

Zanie

03/06/2023, 6:51 PM
Yeah