hi folks, first of all, wanna thank you for creati...
# ask-community
t
hi folks, first of all, wanna thank you for creating such a great tool! I recently realized that besides the workflow orchestration, the block is a really convenient feature for me to store sensitive data. I am wondering, if it possible to use the Prefect block as a standalone module? e,g. using
Secret.load("github-access-token").get()
in normal python scripts?
1
m
Hi Tan, I have included the documentation below for our blocks section. Blocks are usually called during a flow or task run, but they can also be loaded with a unique slug. https://docs.prefect.io/concepts/blocks/
🙌 1
t
Thanks @Matt Conger! Maybe I should just try it out, but I am curious, if we are using block in a standalone way, as stated in the docs, how does the script know the URL of the orion server? i.e. where to fetch the block data?
Copy code
from prefect.blocks.core import Block

json_block = Block.load("json/life-the-universe-everything")
print(json_block.value["the-answer"]) #42
m
Tan, I think even with this method we would still need to have the script integrated with Prefect. I personally have only been using the blocks inside flows but it's definitely worth checking out.
🙌 1