Python SDK
Integrate Onboardbase into your Python projects using our Python SDK
Installation
pip install onboardbase
Setup
Generate .onboardbase.yaml
If you don't have an Onboardbase setup file .onboardbase.yaml, go to your project page on Onboardbase, click on the Env dropdown and click to copy the setup for the project to your clipboard.
Then, create a new file in the root of your project named .onboardbase.yaml and paste the content you copied earlier.
If you have Onboardbase CLI, run the below command and follow the instruction to generate a setup file:
cd path/to/project
onboardbase setup
Your final setup file should look like this:
setup:
project: "test-project"
environment: "development"
Create an API Key
To create a new API Key, go to your account settings page, and click on your organization's tab, you would find API Key sections.
On the API Key section, click on Create API Key, Enter an identifying name and a secure passcode string - you can't view this anymore, make it a memorable string.
Once an API Key is generated, click on the options dropdown of the key and then click on copy to copy the newly generated key to your clipboard.
Final setup
In your project .onboardbase.yaml setup file, add two new fields api_key
and passcode
. Paste the copied API Key from above as the value for the api_key
field and enter your memorable encryption passcode.
api_key: "****ANCAME3CFKJG******"
passcode: "TEST_PASSCODE"
setup:
project: "test-project"
environment: "development"
Integrate Onboardbase Python SDK
After having API Key and passcode integrated into your setup file.
Import Onbaordbase SDK into your project.
from onboardbase import init
Initialize the library when the module is called, which would ensure secrets are available before they are accessed.
if __name__ == "__main__"
init()
And access individual secrets using os.environ
.
print os.environ
Inbuilt SDK Feature
Secure fallback cache
The SDK supports caching your secrets to a secure location on the current computer. This cache is useful in case there is an issue in communicating with Onboardbase servers to serve secrets.
Updated 9 months ago