Background

In order to use the SDK, you first need to get the API key and set it properly. There are two ways to set up your API keys.

Direct use in your code

You can use your API key directly in your code.

python
import podonos
from podonos import *

client = podonos.init(api_key="<YOUR_API_KEY>")

But, committing an API key to your code repository is a common vector for credential compromise. So we strongly recommend the use of the environment variables as a proactive key safety measure.

Please avoid commiting your API key to your code repository.

Add to environment variables

Set your API key as your environment variable.

Linux / MacOS

Set your PODONOS_API_KEY environment variable on your shell command. Run the following command in your terminal, replacing YOUR_API_KEY with your API key.

export PODONOS_API_KEY="YOUR_API_KEY"

Once this is set, you can confirm that you have set your environment variable by using the following command.

echo $PODONOS_API_KEY

Now, in your code, you can skip setting the api_key while initialization.

python
import podonos
from podonos import *

client = podonos.init()

Windows

Run the following in the cmd prompt, and replace <YOUR_API_KEY> with your API key.

setx PODONOS_API_KEY "<YOUR_API_KEY>"

Once the variable is setup, you can validate that the variable has been set properly by opening a new cmd prompt window and typing in

echo %PODONOS_API_KEY%

All set! Let’s use the SDK.