Hi I’m trying to update the base image of a work p...
# prefect-cloud
o
Hi I’m trying to update the base image of a work pool from my CD using python. I didn’t find the python api for this - so I’m trying to use the REST API according to this: https://app.prefect.cloud/api/docs?deviceId=41b4e7ab-6f7b-43ec-864b-17b6563e7ba9#tag/Work-Pools/operation/create_[…]__workspace_id__work_pools__post But I just get 403. (Also for read work pool). What am I missing/doing wrong? Here’s a simple read that fails:
Copy code
headers = {"x-prefect-api-version": "2.14.0"}

        read = (
            f"<https://api.prefect.cloud/api/accounts/{ACCOUNT_ID}/workspaces/{WORKSPACE_ID}/work_pools/{work_pool_name}>"
        )
        response = requests.get(read, headers=headers)
        print(f"{response} {response.json()} {response.headers}")
k
Hi Ofir, are you including your API key as a bearer token in your request headers? I'm not sure if we have a
requests
example anywhere but you may find this curl example helpful.
o
Right! thanks, forgot to add the api key facepalm
k
Don't worry, I've been there 🥹