I've seen other questions about this, but not a solution yet.
When using
Secret.load("slackbot-oauth").get()
, I get
AttributeError: 'coroutine' object has no attribute 'get'
whether I run this in an ipynb or with a python file through the terminal.
Is it expected to run this command with await and async?
Or is this not supposed to happen?
👀 1
a
Andrew Huang
08/16/2022, 5:51 PM
Can you try separating the line?
Copy code
from prefect.blocks.system import Secret
secret = Secret.load("test")
print(secret.get())
Andrew Huang
08/16/2022, 5:52 PM
if you do it in one line, I think you need
await
, or wrap it in a flow to automatically handle.
Copy code
from prefect import flow
from prefect.blocks.system import Secret
@flow
def test_flow():
secret = Secret.load("test").get()
return secret
print(test_flow())
✅ 1
s
Sam Garvis
08/16/2022, 6:32 PM
@Andrew Huang Perfect, thanks. You're second option works great, getting the secrets within the @flow before calling any functions
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.