Skip to main content

How to Access Environment Variables#


When a user provides input via Blueprint Variables, or you pass values to your script using environment variables, you'll want to make sure that you can access these values in your code. This how to guide will walk you through the steps to access environment variables.


When accessing the contents of an environment variable in your code, we recommend storing it as a variable so it can be continuously used.


For this example, our environment variable will be named OPERATOR_A.

  1. Navigate to the location of your code (local, GitHub, etc.)
  2. Select the language your code is written in from the tabs below.
import os
os.environ.get('OPERATOR_A','default value')
  1. Add the above snippet to your code.

You've now successfully written code to access an environment variable.