# Parameters section - define all inputs at the top
api_url = 'https://api.example.com' # @param {type:"string", label:"API URL"}
api_key_name = '' # @param {type:"secret", label:"API Key"}
environment = 'production' # @param ["development", "staging", "production"]
max_results = 100 # @param {type:"integer", min:1, max:1000}
verbose = False # @param {type:"boolean"}
# Get the actual secret value
api_key = SpinSecrets.get_secret(api_key_name)
# Use the parameters in your code
import requests
headers = {"Authorization": f"Bearer {api_key}"}
params = {"env": environment, "limit": max_results}
response = requests.get(f"{api_url}/data", headers=headers, params=params)
data = response.json()
if verbose:
SpinLog.info(f"Retrieved {len(data)} records from {environment}")
CellResult.set_py_result(data)