Step 1
Tue Jul 16 2024 16:03:09 GMT+0000 (Coordinated Universal Time)
Saved by
@vchiranjeeviak
#python
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']
content_copyCOPY
Comments