import os
import requests
import json
from dotenv import load_dotenv
# Load env from .env file.
load_dotenv()
'''
Step 1: Get all env variables.
'''
url_to_get_all_envs = f"https://api.vercel.com/v9/projects/{os.getenv('PROJECT_ID')}/env"
payload = {
'decrypt': 'true',
'slug': os.getenv('SLUG'),
'source': 'vercel-cli:pull',
'teamId': os.getenv('TEAM_ID')
}
headers = {
'Authorization': f"Bearer {os.getenv('VERCEL_TOKEN')}",
'Content-Type': 'application/json'
}
all_env_vars = requests.get(
url_to_get_all_envs,
params=payload,
headers=headers
)
# Print the response in a safe environment if required.
all_env_vars = all_env_vars.json()['envs']
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter