-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from narenaryan/docs/add-programmatic-access
docs: create programmatic-access guide
- Loading branch information
Showing
2 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Programmatic access of Whispr | ||
|
||
In addition to installing Whispr as a tool, one can make use of core utility functions like this: | ||
|
||
```bash | ||
pip install whispr | ||
``` | ||
|
||
Then from Python code you can import important functions like this: | ||
|
||
```py | ||
from whispr.utils.vault import fetch_secrets | ||
from whispr.utils.process import execute_command | ||
|
||
config = { | ||
"vault": "aws", | ||
"secret_name": "<your_secret_name>" | ||
} | ||
|
||
secrets = fetch_secrets(config) | ||
|
||
# Now, inject secrets into your command's environment by calling this function | ||
command = "ls -l" | ||
execute_command(command.split(), no_env=False, secrets=secrets) | ||
``` | ||
|
||
That's it. This is a programmatic equivalent to the tool usage. |