how do i get a list of all prefect deployments in ...
# ask-community
d
how do i get a list of all prefect deployments in python
j
I think you are looking for
read_deployments
endpoint from Rest API, I don't see list/read deployments in Prefect Python SDK docs. Rest API docs for read_deployments here
d
locally? if i dont have account id and workspace id
j
Do you use Prefect Cloud? or are you self-hosting?
d
self hosting
j
ahh, I use Cloud, so my answer may be useless. Usually you can just grab those parameters from cloud URL. I am not sure for self-hosting, sorry 😞
n
hi @Derrell - you can use the client method
Copy code
from prefect import get_client

async with get_client() as client:
  deployments: list["Deployment"] = await client.read_deployments() # all by default
👀 1
107 Views