https://prefect.io logo
Title
s

Sam Garvis

08/16/2022, 5:45 PM
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?
from prefect.blocks.system import Secret

secret = Secret.load("test")
print(secret.get())
if you do it in one line, I think you need
await
, or wrap it in a flow to automatically handle.
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
🙌 1