How do I access an Environment Variable in a python code block?

I want to store an API key as an environment variable and access it in a python code step but the only example give references ‘process.env.ENV_VAR’ which doesn’t work for me…

Thanks.

Hello @appcaptapps,

First off, welcome to Pipedream! Happy to have you!

You can refer to this document to understand how to use Env vars in Python code block: Python

import os
import requests

def handler(pd: "pipedream"):
  token = os.environ['TWITTER_API_KEY']

  print(token)

Thanks,

Both the link and the example helped solve the problem!