Skip to content

Instantly share code, notes, and snippets.

@sandalsoft
Created August 15, 2025 13:57
Show Gist options
  • Save sandalsoft/d5294f0a5f2ed4eb4f40482c9fe14b81 to your computer and use it in GitHub Desktop.
Save sandalsoft/d5294f0a5f2ed4eb4f40482c9fe14b81 to your computer and use it in GitHub Desktop.
import os
import sys
import requests
# Check required environment variables
access_token = os.getenv('PROMPTQL_ACCESS_TOKEN')
if not access_token:
print("Error: PROMPTQL_ACCESS_TOKEN environment variable is not set or empty. Use a project service account token or Personal Access Token (PAT)", file=sys.stderr)
sys.exit(1)
project_id = os.getenv('PROMPTQL_PROJECT_ID')
if not project_id:
print("Error: PROMPTQL_PROJECT_ID environment variable is not set or empty", file=sys.stderr)
sys.exit(1)
url = os.getenv("PROMPTQL_TOKEN_REFRESH_URL", "https://auth.pro.hasura.io/ddn/promptql/token")
headers = {
"Authorization": f"pat {access_token}",
"x-hasura-project-id": project_id,
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
print(response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment