#!/usr/bin/env python3 import os import requests from dotenv import load_dotenv # Load RunPod API key env_path = '.env.runpod' load_dotenv(env_path) RUNPOD_API_KEY = os.getenv('RUNPOD_API_KEY') if not RUNPOD_API_KEY: print("ERROR: RUNPOD_API_KEY not found in .env.runpod") exit(1) # GraphQL query with correct field name query = """ query { myself { containerRegistryCreds { id name username createdAt } } } """ headers = { "Content-Type": "application/json", "Authorization": f"Bearer {RUNPOD_API_KEY}" } response = requests.post( "https://api.runpod.io/graphql", json={"query": query}, headers=headers ) result = response.json() print("Full API Response:") print("=" * 60) print(result) print("=" * 60) if 'data' in result and result['data']['myself']: creds = result['data']['myself'].get('containerRegistryCreds', []) if creds: print("\n✅ Found Docker Hub credentials:") for cred in creds: print(f"\n Credential #{creds.index(cred) + 1}:") print(f" ID: {cred['id']}") print(f" Name: {cred['name']}") print(f" Username: {cred['username']}") print(f" Created: {cred['createdAt']}") # Check .env.runpod print("\n" + "=" * 60) print("Checking .env.runpod configuration:") print("=" * 60) configured_id = os.getenv('RUNPOD_CONTAINER_REGISTRY_AUTH_ID') if configured_id: print(f"✅ RUNPOD_CONTAINER_REGISTRY_AUTH_ID is set to: {configured_id}") # Check if it matches any credential matching = [c for c in creds if c['id'] == configured_id] if matching: print(f"✅ Credential ID matches: {matching[0]['name']}") else: print(f"⚠️ WARNING: Credential ID does not match any RunPod credentials!") print(f" Available IDs:") for cred in creds: print(f" - {cred['id']} ({cred['name']})") else: print("⚠️ RUNPOD_CONTAINER_REGISTRY_AUTH_ID is NOT set in .env.runpod") print(f" Set it to one of these IDs:") for cred in creds: print(f" - {cred['id']} ({cred['name']})") else: print("\n⚠️ No Docker Hub credentials configured in RunPod") print("You need to create one via RunPod console or API") print("\nManual steps:") print("1. Go to: https://www.runpod.io/console/user/settings") print("2. Click 'Container Registry Credentials' tab") print("3. Add credentials for Docker Hub (jgrusewski)") else: print("\n❌ Error querying credentials:", result)