Skip to content

Commit

Permalink
docs: create programmatic-access guide
Browse files Browse the repository at this point in the history
  • Loading branch information
narenaryan authored Nov 17, 2024
1 parent 6277d32 commit 7e33dfd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions usage-guides/programmatic-access.md
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.

0 comments on commit 7e33dfd

Please sign in to comment.