Setting up Environmental Variables
Setting up environmental variables to hold secret keys is the best way to ensure no secret leaks of sensitive information.
Load Environmental Variables
Load environmental variables one of the two following ways
If set variables using .env file :
[ ]:
import os
from dotenv import load_dotenv
load_dotenv()
os.getenv('ENV_KEY_NAME') # Example: 'AZURE_API_KEY'
If setting environmental variables with source or set :
[ ]:
import os
os.getenv('ENV_KEY_NAME') # Example: 'AZURE_API_KEY'